Package org.apache.log

Examples of org.apache.log.ErrorHandler


        final ServletOutputLogTarget servTarget = new ServletOutputLogTarget(this.servletContext );

        servTarget.setFormatter(formatter);

        final Hierarchy defaultHierarchy = Hierarchy.getDefaultHierarchy();
        final ErrorHandler errorHandler = new DefaultErrorHandler();
        defaultHierarchy.setErrorHandler(errorHandler );
        defaultHierarchy.setDefaultLogTarget(servTarget);
        defaultHierarchy.setDefaultPriority(logPriority);
        final Logger logger = new LogKitLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(""));
        final LogKitLoggerManager logKitLoggerManager = new LogKitLoggerManager(defaultHierarchy);
        logKitLoggerManager.enableLogging(logger);
        final DefaultContext subcontext = new DefaultContext(this.appContext);
        subcontext.put("servlet-context", this.servletContext);
        if (this.servletContextPath == null) {
            File logSCDir = new File(this.workDir, "log");
            logSCDir.mkdirs();
            if (logger.isWarnEnabled()) {
                logger.warn("Setting servlet-context for LogKit to " + logSCDir);
            }
            subcontext.put("context-root", logSCDir.toString());
        } else {
            subcontext.put("context-root", this.servletContextPath);
        }

        try {
            logKitLoggerManager.contextualize(subcontext);
            this.loggerManager = logKitLoggerManager;

            //Configure the logkit management
            String logkitConfig = getInitParameter("logkit-config", "/WEB-INF/logkit.xconf");

            // test if this is a qualified url
            InputStream is = null;
            if ( logkitConfig.indexOf(':') == -1) {
                is = this.servletContext.getResourceAsStream(logkitConfig);
                if (is == null) is = new FileInputStream(logkitConfig);
            } else {
                URL logkitURL = new URL(logkitConfig);
                is = logkitURL.openStream();
            }
            final DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
            final Configuration conf = builder.build(is);
            logKitLoggerManager.configure(conf);
        } catch (Exception e) {
            errorHandler.error("Could not set up Cocoon Logger, will use screen instead", e, null);
        }

        if (accesslogger != null) {
            this.log = logKitLoggerManager.getLoggerForCategory(accesslogger);
        } else {
View Full Code Here

TOP

Related Classes of org.apache.log.ErrorHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.