logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hein Meling <mel...@acm.org>
Subject ThreadId in the PatternLayout
Date Wed, 22 Dec 2004 10:42:24 GMT
Hi all.

I've done a simple pattern converter for my own use to distinguish
multiple threads with the same name (some API libraries create multiple
threads with the same name, which sometimes makes it difficult to debug,
e.g. the Jini task manager).  I've added the conversion rule below and
the class implementing this is in attachment.

<layout class="org.apache.log4j.PatternLayout">
 <conversionRule conversionWord="threadid" 
                 converterClass="jgroup.util.ThreadIdPatternConverter"/>
 <param name="ConversionPattern"
        value="%-7r %-5p [%t-%threadid] %c{2}.%M: %m%n"/>
</layout>

If this is something that others might benefit from, feel free to
include this in the next release of Log4j.

Hein

Mime
View raw message