avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: LogKit - Formatting
Date Thu, 02 May 2002 22:46:44 GMT
On Fri, 3 May 2002 05:02, Approved List wrote:
> I have created a simple test using the following code from the LogKit
> whitepaper...
>
> Logger logger = Hierarchy.getDefaultHierarchy().getLoggerFor("myCategory");
> logger.setPriority( Priority.DEBUG );
> logger.debug( "This is a debug message" );

Try the following


//Setup formatter
final PatternFormatter formatter =
 new PatternFormatter( "%{priority}:%{time}:%{category}:%{message}\n" );

//setup endpoint for log messages
final StreamTarget target = 
   new StreamTarget( System.out, formatter );

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


>
> In the console I see the following...
>
> DEBUG   10203   [myCatego] (): This is a debug message
>
> I need to console to read as follows...
>
> DEBUG:1020365844974:myCategory:This is a debug message
>
> I am sure that it is possible to configure LogKit with custom formats,
> however, I am at a loss as to how to accomplish this seemingly simple task.
>
> Any assistance would be greatly appreciated.
>
> Thanks.
>
> Tal Golan
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.351 / Virus Database: 197 - Release Date: 4/19/2002

-- 
Cheers,

Peter Donald


--
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