Package org.apache.avalon.excalibur.logger

Examples of org.apache.avalon.excalibur.logger.LogKitLoggerManager


                Constants.CONTEXT_CLASS_LOADER,
                CocoonWrapper.class.getClassLoader());
            cliContext = new CommandLineContext(contextDir);
            cliContext.enableLogging(log);
            appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, cliContext);
            LogKitLoggerManager logKitLoggerManager =
                    new LogKitLoggerManager(Hierarchy.getDefaultHierarchy());
            logKitLoggerManager.enableLogging(log);

            if (this.logKit != null) {
                final FileInputStream fis = new FileInputStream(logKit);
                final DefaultConfigurationBuilder builder =
                    new DefaultConfigurationBuilder();
                final Configuration logKitConf = builder.build(fis);
                final DefaultContext subcontext = new DefaultContext(appContext);
                subcontext.put("context-root", contextDir);
                logKitLoggerManager.contextualize(subcontext);
                logKitLoggerManager.configure(logKitConf);
                if (logger != null) {
                    log = logKitLoggerManager.getLoggerForCategory(logger);
                } else {
                    log = logKitLoggerManager.getLoggerForCategory("cocoon");
                }
            }

            appContext.put(Constants.CONTEXT_CLASSPATH, getClassPath(contextDir));
            appContext.put(Constants.CONTEXT_WORK_DIR, work);
View Full Code Here


            return;
        }

        // Make sure same hierarchy is used
        Hierarchy hier = Hierarchy.getDefaultHierarchy();
        LogKitLoggerManager manager = new LogKitLoggerManager(null, hier, null, null);

        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
        try {
            Configuration c = builder.buildFromFile(cfg);
            Context ctx = new DefaultContext();
            manager.contextualize(ctx);
            manager.configure(c);
        } catch (IllegalArgumentException e) {
            // This happens if the default log-target id-ref specifies a non-existent target
            System.out.println("Error processing logging config " + cfg);
            System.out.println(e.toString());
        } catch (NullPointerException e) {
View Full Code Here

            this.context = getDir(this.contextDir, "context");
            this.work = getDir(workDir, "working");
            DefaultContext appContext = new DefaultContext();
            appContext.put(Constants.CONTEXT_WORK_DIR, work);

            this.logManager = new LogKitLoggerManager(hierarchy);
            this.logManager.enableLogging(log);

            if (this.logKit != null) {
                final FileInputStream fis = new FileInputStream(logKit);
                final DefaultConfigurationBuilder builder =
View Full Code Here

            Hierarchy.getDefaultHierarchy().getLoggerFor( lmLoggerName );
        lmLogger.setPriority( Priority.getPriorityForName(
            loggerManagerConfig.getAttribute( "log-level", "DEBUG" ) ) );

        // Setup the Logger Manager
        LogKitLoggerManager loggerManager = new LogKitLoggerManager(
            logPrefix, Hierarchy.getDefaultHierarchy(),
            new LogKitLogger( lmDefaultLogger ), new LogKitLogger( lmLogger ) );
        loggerManager.contextualize( m_context );
        loggerManager.configure( loggerManagerConfig );
        m_loggerManager = loggerManager;

        // Since we now have a LoggerManager, we can update the m_logger field
        //  if it is null and start logging to the "right" logger.
        if( m_logger == null )
View Full Code Here

                Constants.CONTEXT_CLASS_LOADER,
                CocoonWrapper.class.getClassLoader());
            cliContext = new CommandLineContext(contextDir);
            cliContext.enableLogging(log);
            appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, cliContext);
            LogKitLoggerManager logKitLoggerManager =
                    new LogKitLoggerManager(Hierarchy.getDefaultHierarchy());
            logKitLoggerManager.enableLogging(log);

            if (this.logKit != null) {
                final FileInputStream fis = new FileInputStream(logKit);
                final DefaultConfigurationBuilder builder =
                    new DefaultConfigurationBuilder();
                final Configuration logKitConf = builder.build(fis);
                final DefaultContext subcontext = new DefaultContext(appContext);
                subcontext.put("context-root", contextDir);
                logKitLoggerManager.contextualize(subcontext);
                logKitLoggerManager.configure(logKitConf);
                if (logger != null) {
                    log = logKitLoggerManager.getLoggerForCategory(logger);
                } else {
                    log = logKitLoggerManager.getLoggerForCategory("cocoon");
                }
            }

            appContext.put(Constants.CONTEXT_CLASSPATH, getClassPath(contextDir));
            appContext.put(Constants.CONTEXT_WORK_DIR, work);
View Full Code Here

        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 {
            this.log = logKitLoggerManager.getLoggerForCategory("cocoon");
        }
    }
View Full Code Here

        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("portlet-context", this.portletContext);
        if (this.portletContextPath == 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.portletContextPath);
        }

        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.portletContext.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 {
            this.log = logKitLoggerManager.getLoggerForCategory("cocoon");
        }
    }
View Full Code Here

            manager.configure( logs );
            return manager.getDefaultLogger();
        }
        else if( version.equals( "1.1" ) )
        {
            final LogKitLoggerManager manager =
                new LogKitLoggerManager();
            setupLogger( manager );
            manager.contextualize( context );
            manager.configure( logs );
            return manager.getDefaultLogger();
        }
        else
        {
            final String message = "Unknown log version specification";
            throw new IllegalArgumentException( message );
View Full Code Here

    logConfigFile = new File(logConfigFilename);

    if (logConfigFile.exists())
    {
      //Continue with logkit configuration
      lm = new LogKitLoggerManager(null, new Hierarchy(), new ConsoleLogger(ConsoleLogger.LEVEL_INFO));
    }
    else
    {
      lm = null;
    }
View Full Code Here

      File primordialLogConfigFile = new File(logConfigDir + logConfigFilename);

      if (primordialLogConfigFile.exists())
      {
        //Continue with logkit configuration
        primordialLoggerManager = new LogKitLoggerManager(null, new Hierarchy(), new ConsoleLogger(
                ConsoleLogger.LEVEL_INFO));
      }
      else
      {
        System.err.println("Logkit config file " + logConfigDir + logConfigFilename
View Full Code Here

TOP

Related Classes of org.apache.avalon.excalibur.logger.LogKitLoggerManager

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.