avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: Asynchronous LogTarget
Date Wed, 16 Jan 2002 09:28:20 GMT
On Wed, 16 Jan 2002 15:57, Berin Loritsch wrote:
> Peter Donald wrote:
> > Are you using the CVS version of it?
>
> Yes.

you sure ?

The following works for me

package org.apache.log.output;

import org.apache.log.Hierarchy;
import org.apache.log.Logger;
import org.apache.log.LogTarget;
import org.apache.log.format.PatternFormatter;
import org.apache.log.output.io.StreamTarget;

public class AsyncLogTest
{

    public static void main( String[] args )
    {
        final PatternFormatter formatter = new PatternFormatter( 
"%{message}\n" );
        final LogTarget mySlowTarget = new StreamTarget( System.out, 
formatter );
        AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
        Thread thread = new Thread( asyncTarget );
        thread.setPriority( Thread.MIN_PRIORITY );
        thread.start();

        final Hierarchy h = new Hierarchy();
        final Logger logger = h.getLoggerFor( "meep" );
        logger.setLogTargets( new LogTarget[] { asyncTarget } );

        logger.debug( "meep meep!" );
        logger.debug( "meep meep!" );
        logger.debug( "meep meep!" );
    }
}



-- 
Cheers,

Pete

--------------------------------
 These aren't the droids you're 
 looking for. Move along. 
--------------------------------

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message