Examples of LogkitLoggerManager


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

        Deprecation.setForbiddenLevel(Deprecation.LogLevel.getLevel(deprecationLevel));
    }

    private LoggerManager newLoggerManager(String loggerManagerClass, Hierarchy hierarchy) {
        if (loggerManagerClass.equals(LogKitLoggerManager.class.getName())) {
            return new LogKitLoggerManager(hierarchy);
        } else if (loggerManagerClass.equals(Log4JLoggerManager.class.getName()) ||
                   loggerManagerClass.equalsIgnoreCase("LOG4J")) {
            return new Log4JLoggerManager();
        } else {
            try {
                Class clazz = Class.forName(loggerManagerClass);
                return (LoggerManager)clazz.newInstance();
            } catch (Exception e) {
                return new LogKitLoggerManager(hierarchy);
            }
        }
    }
View Full Code Here

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

            final String lmDefaultLoggerName =
                (String) get( m_rootContext, ContextManagerConstants.LOG_CATEGORY, "fortress" );
            final String lmLoggerName = loggerManagerConfig.getAttribute( "logger", "system.logkit" );

            // Setup the Logger Manager
            m_loggerManager = new LogKitLoggerManager( lmDefaultLoggerName, lmLoggerName );

            ContainerUtil.enableLogging( m_loggerManager, getLogger() );
            ContainerUtil.contextualize( m_loggerManager, m_rootContext );
            ContainerUtil.configure( m_loggerManager, loggerManagerConfig );
            ContainerUtil.start( m_loggerManager );
View Full Code Here

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

            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

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

    if (cfg == null)
      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());
View Full Code Here

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

        Deprecation.setForbiddenLevel(Deprecation.LogLevel.getLevel(deprecationLevel));
    }

    private LoggerManager newLoggerManager(String loggerManagerClass, Hierarchy hierarchy) {
        if (loggerManagerClass.equals(LogKitLoggerManager.class.getName())) {
            return new LogKitLoggerManager(hierarchy);
        } else if (loggerManagerClass.equals(Log4JLoggerManager.class.getName()) ||
                   loggerManagerClass.equalsIgnoreCase("LOG4J")) {
            return new Log4JLoggerManager();
        } else {
            try {
                Class clazz = Class.forName(loggerManagerClass);
                return (LoggerManager)clazz.newInstance();
            } catch (Exception e) {
                return new LogKitLoggerManager(hierarchy);
            }
        }
    }
View Full Code Here

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

            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

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

        final Hierarchy defaultHierarchy = Hierarchy.getDefaultHierarchy();

        final Logger logger = new LogKitLogger(Hierarchy.getDefaultHierarchy().getLoggerFor(""));

        final LogKitLoggerManager logKitLoggerManager = new LogKitLoggerManager(defaultHierarchy);
        logKitLoggerManager.enableLogging(logger);

        final DefaultContext subcontext = new DefaultContext();
        subcontext.put(Constants.CONTEXT_WORK_DIR, workDir);
        subcontext.put("portlet-context", this.portletContext);
        if (this.portletContextPath == null) {
            File logSCDir = new File(this.workDir, "log");
            logSCDir.mkdirs();
            if (getLogger().isWarnEnabled()) {
                getLogger().warn("Setting context-root for LogKit to " + logSCDir);
            }
            subcontext.put("context-root", logSCDir.toString());
        } else {
            subcontext.put("context-root", this.portletContextPath);
        }
        if ( this.portletContext instanceof PortletContextImpl ) {
            subcontext.put("servlet-context", ((PortletContextImpl)this.portletContext).getServletContext());
        }

        try {
            logKitLoggerManager.contextualize(subcontext);

            //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) {
            e.printStackTrace();
        }

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

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

        this.log = this.loggerManager.getLoggerForCategory(accesslogger);
    }

    private LoggerManager newLoggerManager(String loggerManagerClass, Hierarchy hierarchy) {
        if (loggerManagerClass.equals(LogKitLoggerManager.class.getName())) {
            return new LogKitLoggerManager(hierarchy);
        } else if (loggerManagerClass.equals(Log4JLoggerManager.class.getName()) ||
                   loggerManagerClass.equalsIgnoreCase("LOG4J")) {
            return new Log4JLoggerManager();
        } else {
            try {
                Class clazz = Class.forName(loggerManagerClass);
                return (LoggerManager)clazz.newInstance();
            } catch (Exception e) {
                return new LogKitLoggerManager(hierarchy);
            }
        }
    }
View Full Code Here

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

    if (cfg == null)
      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

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

            final String lmDefaultLoggerName =
                (String) get( m_rootContext, ContextManagerConstants.LOG_CATEGORY, "fortress" );
            final String lmLoggerName = loggerManagerConfig.getAttribute( "logger", "system.logkit" );

            // Setup the Logger Manager
            m_loggerManager = new LogKitLoggerManager( lmDefaultLoggerName, lmLoggerName );

            ContainerUtil.enableLogging( m_loggerManager, getLogger() );
            ContainerUtil.contextualize( m_loggerManager, m_rootContext );
            ContainerUtil.configure( m_loggerManager, loggerManagerConfig );
            ContainerUtil.start( m_loggerManager );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.