How to track log messages by thread

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
 
Line 10: Line 10:
  
 
   <log name="" level="finer" path="log/debug.log"
 
   <log name="" level="finer" path="log/debug.log"
         format=" ${log.threadId}: ${log.message}"/>
+
         format="<${log.threadId}> ${log.message}"/>

Revision as of 22:56, 31 March 2006


Main article: log

Since Resin is a multithreaded program, logging messages from many requests and threads are serialized in the log files. In some cases, it it useful to keep track of the log messages for a single thread.

The format attribute in the <log> tag lets you customize the log message to include the thread id The format is a string with interpolated EL expressions specifying the format. The value ${log.threadId} adds a thread identifier to the message, while ${log.message} returns the log message.

So an example format might be

 <log name="" level="finer" path="log/debug.log"
        format="<${log.threadId}> ${log.message}"/>
Personal tools