Package org.apache.log

Examples of org.apache.log.Hierarchy$InnerErrorHandler


        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);
View Full Code Here


        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);
View Full Code Here

        assertEquals( "Targets R3 debug output", R2 + R3 + R3, result4 );
    }

    private Logger getNewLogger( final LogTarget target )
    {
        final Hierarchy hierarchy = new Hierarchy();
        final Logger logger = hierarchy.getLoggerFor( "myCategory" );
        logger.setLogTargets( new LogTarget[]{target} );
        return logger;
    }
View Full Code Here

    }

    protected void initLogger() {
        final String accesslogger = getInitParameter("portlet-logger", "cocoon");

        final Hierarchy defaultHierarchy = Hierarchy.getDefaultHierarchy();

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

        final LogKitLoggerManager logKitLoggerManager = new LogKitLoggerManager(defaultHierarchy);
        logKitLoggerManager.enableLogging(logger);
View Full Code Here

        final CocoonLogFormatter formatter = new CocoonLogFormatter();
        formatter.setFormat("%7.7{priority} %{time}   [%8.8{category}] " +
                            "(%{uri}) %{thread}/%{class:short}: %{message}\\n%{throwable}");
        final ServletOutputLogTarget servTarget = new ServletOutputLogTarget(this.servletContext, 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 String loggerManagerClass =
            this.getInitParameter("logger-class", LogKitLoggerManager.class.getName());

        // the log4j support requires currently that the log4j system is already configured elsewhere
View Full Code Here

        Logger lmLogger = Hierarchy.getDefaultHierarchy().getLoggerFor( lmLoggerName );
        lmLogger.setPriority( lmPriority );
        logKitManager.enableLogging( new LogKitLogger( lmLogger ) );
        logKitManager.contextualize( context );
        logKitManager.configure( confLM );
        Hierarchy h = logKitManager.getHierarchy();
        h.setDefaultPriority( lmPriority );
        m_logKitManager = logKitManager;

        // Setup the RoleManager
        String rmLoggerName = confRM.getAttribute( "logger", "rm" );
        DefaultRoleManager roleManager = new DefaultRoleManager();
View Full Code Here

    // @todo@ these should log then throw exceptions back to the caller, not
    // use system.exit()

    // Create a new hierarchy. This is needed when CocoonBean is called from
    // within a CocoonServlet call, in order not to mix logs
    final Hierarchy hierarchy = new Hierarchy();

    final Priority priority = Priority.getPriorityForName(this.logLevel);
    hierarchy.setDefaultPriority(priority);

    // Install a temporary logger so that getDir() can log if needed
    this.log = new LogKitLogger(hierarchy.getLoggerFor(""));

    try {
            // First of all, initialize the logging system

            // Setup the application context with context-dir and work-dir that
View Full Code Here

                             "(%{uri}) %{thread}/%{class:short}: %{message}\\n%{throwable}" );
        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);
View Full Code Here

                              final RotateStrategy rotateStrategy )
        throws Exception
    {
        final RotatingFileTarget target =
            new RotatingFileTarget( m_formatter, rotateStrategy, fileStrategy );
        final Hierarchy hierarchy = new Hierarchy();
        final Logger logger = hierarchy.getLoggerFor( "myCat" );

        logger.setLogTargets( new LogTarget[]{target} );

        return logger;
    }
View Full Code Here

        throws Exception
    {
        final ByteArrayOutputStream output = new ByteArrayOutputStream();
        final StreamTarget target = new StreamTarget( output, FORMATTER );

        final Hierarchy hierarchy = new Hierarchy();
        hierarchy.setDefaultLogTarget( target );

        final Logger logger = hierarchy.getLoggerFor( "myLogger" );
        final LoggerOutputStream outputStream = new LoggerOutputStream( logger, Priority.DEBUG );
        final PrintStream printer = new PrintStream( outputStream, true );

        printer.println( MSG );
        assertEquals( "LoggerOutputStream", RMSG + EOL, getResult( output ) );
View Full Code Here

TOP

Related Classes of org.apache.log.Hierarchy$InnerErrorHandler

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.