Package org.apache.log

Examples of org.apache.log.Logger


    private LogkitLogger createLogger( final MockLogTarget target,
                                       final Priority priority )
    {
        final Hierarchy hierarchy = new Hierarchy();
        final Logger logkitLogger = hierarchy.getLoggerFor( "test" );
        logkitLogger.setLogTargets( new LogTarget[]{target} );
        logkitLogger.setPriority( priority );
        final LogkitLogger logger = new LogkitLogger( logkitLogger );
        return logger;
    }
View Full Code Here


        public PackageTest(String name) {
            super(name);
        }

        public void testAdd1() throws Exception {
            Logger log = LoggingManager.getLoggerForClass();
            Collection<String> treePath = Arrays.asList(new String[] { "1", "2", "3", "4" });
            HashTree tree = new HashTree();
            log.debug("treePath = " + treePath);
            tree.add(treePath, "value");
            log.debug("Now treePath = " + treePath);
            log.debug(tree.toString());
            assertEquals(1, tree.list(treePath).size());
            assertEquals("value", tree.getArray(treePath)[0]);
        }
View Full Code Here

     *
     * @param target the LogTarget
     * @param category the category name
     */
    public static void setTarget(LogTarget target, String category) {
        Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor(category);
        logger.setLogTargets(new LogTarget[] { target });
    }
View Full Code Here

        lkmt.dispose();
    }

    protected void test()
    {
        Logger log1 = m_lkm.getLogger( "cocoon" );
        log1.debug( "this is the cocoon logger" );
        log1.info( "this is the cocoon logger" );
        log1.info( "this is the cocoon logger" );
        Logger log2 = log1.getChildLogger( "classloader" );
        log2.debug( "this is the childlogger classloader of the cocoon logger" );
        log2.info( "this is the childlogger classloader of the cocoon logger" );
        Logger log3 = m_lkm.getLogger( "cocoon.classloader" );
        log3.debug( "this is the cocoon.classloader logger" );
        log3.info( "this is the cocoon.classloader logger" );
        Logger log4 = m_lkm.getLogger( "foo" );
        log4.debug( "this is the foo logger" );
        log4.info( "this is the foo logger" );
    }
View Full Code Here

        throws Exception
    {
        //FIXME(GP): This method should setup a LogConfigurator and LogManager
        //           according to the configuration spec. not yet completed/implemented
        //           It will return a default logger for now.
        final Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor( "" );
        logger.setPriority( m_logPriority );

        final PatternFormatter formatter = new PatternFormatter( FORMAT );
        final StreamTarget target = new StreamTarget( System.out, formatter );
        logger.setLogTargets( new LogTarget[]{target} );

        return logger;
    }
View Full Code Here

            final Configuration category = categories[ i ];
            final String name = category.getAttribute( "name", "" );
            final String target = category.getAttribute( "target" );
            final String priorityName = category.getAttribute( "priority" );

            final Logger logger =
                m_logkitLogger.getChildLogger( name );

            final LogTarget logTarget = (LogTarget)targets.get( target );
            if( null == target )
            {
                final String message = REZ.getString( "unknown-target", target, name );
                throw new ConfigurationException( message );
            }

            final Priority priority = Priority.getPriorityForName( priorityName );
            if( !priority.getName().equals( priorityName ) )
            {
                final String message = REZ.getString( "unknown-priority", priorityName, name );
                throw new ConfigurationException( message );
            }

            if( getLogger().isDebugEnabled() )
            {
                final String message =
                    REZ.getString( "category-create", name, target, priorityName );
                getLogger().debug( message );
            }

            if( name.equals( "" ) )
            {
                m_logkitLogger.setPriority( priority );
                m_logkitLogger.setLogTargets( new LogTarget[] {logTarget} );
            }
            else
            {
                logger.setPriority( priority );
                logger.setLogTargets( new LogTarget[]{logTarget} );
            }
        }
    }
View Full Code Here

     * @param categoryName  The category name of a configured Logger.
     * @return the Logger.
     */
    public final Logger getLogger( final String categoryName )
    {
        final Logger logger = (Logger)m_loggers.get( categoryName );

        if( null != logger )
        {
            if( getLogger().isDebugEnabled() )
            {
View Full Code Here

            else
            {
                fullCategory = parentCategory + Logger.CATEGORY_SEPARATOR + category;
            }

            final Logger logger =
                m_hierarchy.getLoggerFor( fullCategory );
            m_loggers.put( fullCategory, logger );
            if( getLogger().isDebugEnabled() )
            {
                getLogger().debug( "added logger for category " + fullCategory );
            }
            logger.setPriority( Priority.getPriorityForName( loglevel ) );
            logger.setLogTargets( logTargets );

            final Configuration[] subCategories = categories[ i ].getChildren( "category" );
            if( null != subCategories )
            {
                setupLoggers( targetManager, fullCategory, subCategories );
View Full Code Here

    /**
     * Initialize logger.
     */
    protected Logger setupLogger() {
        Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor("XmlForm");

        logger.setPriority(Priority.ERROR);
        return logger;
    }
View Full Code Here

    /**
     * Initialize logger.
     */
    protected Logger setupLogger() {
        Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor("XmlForm");

        logger.setPriority(Priority.ERROR);
        return logger;
    }
View Full Code Here

TOP

Related Classes of org.apache.log.Logger

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.