Package org.codehaus.plexus.logging

Examples of org.codehaus.plexus.logging.LoggerManager


    public void execute( Object object, ComponentManager componentManager, ClassRealm lookupRealm )
        throws PhaseExecutionException
    {
        if ( object instanceof LogEnabled )
        {
            LoggerManager loggerManager = componentManager.getContainer().getLoggerManager();

            ComponentDescriptor descriptor = componentManager.getComponentDescriptor();

            Logger logger = loggerManager.getLoggerForComponent( descriptor.getRole(), descriptor.getRoleHint() );

            ( (LogEnabled) object ).enableLogging( logger );
        }
    }
View Full Code Here


    extends AbstractCoreComponentInitializationPhase
{
    public void initializeCoreComponent( ContainerInitializationContext context )
        throws ContainerInitializationException
    {
        LoggerManager loggerManager = context.getContainer().getLoggerManager();

        // ----------------------------------------------------------------------
        // The logger manager may have been set programmatically so we need
        // to check. If it hasn't
        // ----------------------------------------------------------------------

        if ( loggerManager == null )
        {
            try
            {
                /* as we do not know what logger role hint has been configured pull the first logger we find. Andy
                 * TODO - figure how to make this more determanistic? */
                Map loggers = context.getContainer().lookupMap( LoggerManager.ROLE );
                loggerManager = (LoggerManager) loggers.get( loggers.keySet().iterator().next() );

                context.getContainer().setLoggerManager( loggerManager );
            }
            catch ( ComponentLookupException e )
            {
                throw new ContainerInitializationException( "Unable to locate logger manager", e );
            }
        }

        //TODO: the container should allow this logger manager change, don't use the DefaultPlexusContainer
        context.getContainer().enableLogging( loggerManager.getLoggerForComponent( PlexusContainer.class.getName() ) );
    }
View Full Code Here

    public void execute( Object object, ComponentManager componentManager, ClassRealm lookupRealm )
        throws PhaseExecutionException
    {
        if ( object instanceof LogEnabled )
        {
            LoggerManager loggerManager;
            try
            {
                /* as we do not know what logger role hint has been configured pull the first logger we find. Andy
                 * TODO - figure how to make this more determanistic? */
                Map loggers = componentManager.getContainer().lookupMap( LoggerManager.ROLE, lookupRealm );
                loggerManager = (LoggerManager) loggers.get( loggers.keySet().iterator().next() );
            }
            catch ( ComponentLookupException e )
            {
                throw new PhaseExecutionException( "Unable to locate logger manager", e );
            }

            ComponentDescriptor descriptor = componentManager.getComponentDescriptor();
            loggerManager.returnComponentLogger( descriptor.getRole(), descriptor.getRoleHint() );
        }
    }
View Full Code Here

    public void execute( Object object, ComponentManager componentManager, ClassRealm lookupRealm )
        throws PhaseExecutionException
    {
        if ( object instanceof LogEnabled )
        {
            LoggerManager loggerManager;
            try
            {
                /* as we do not know what logger role hint has been configured pull the first logger we find. Andy
                 * TODO - figure how to make this more determanistic? */
                Map loggers = componentManager.getContainer().lookupMap( LoggerManager.ROLE, lookupRealm );
                loggerManager = (LoggerManager) loggers.get( loggers.keySet().iterator().next() );
            }
            catch ( ComponentLookupException e )
            {
                throw new PhaseExecutionException( "Unable to locate logger manager", e );
            }

            ComponentDescriptor descriptor = componentManager.getComponentDescriptor();

            Logger logger = loggerManager.getLoggerForComponent( descriptor.getRole(), descriptor.getRoleHint() );

            ( (LogEnabled) object ).enableLogging( logger );
        }
    }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.logging.LoggerManager

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.