Config: Important Loggers

From Resin 4.0 Wiki

(Difference between revisions)
Jump to: navigation, search
(Created page with "Category:Resin: Application Server: Configuration link=Category:Resin: Application Server: Configuration ==== We often get asked how to enable addi...")
 
Line 2: Line 2:
 
[[Image:Gears-48.png|link=Category:Resin: Application Server: Configuration]]
 
[[Image:Gears-48.png|link=Category:Resin: Application Server: Configuration]]
  
==== We often get asked how to enable additional logging to debug a particular Resin behavior====
+
==== We often get asked how to enable additional logging to debug a particular Resin behavior ====  
  
 
On this page I will provide example of alternative log formats, and list a few key internal classes that can produce helpful debugging logs.
 
On this page I will provide example of alternative log formats, and list a few key internal classes that can produce helpful debugging logs.
 +
 +
== Log Format ==
 +
 +
Resin's default log format (as of 4.0.29) is the following:
 +
 +
<log-handler name="" level="all" path="stdout:"
 +
    timestamp="[%y-%m-%d %H:%M:%S.%s]"
 +
    format=" {${thread}} ${log.message}"/>
 +
 +
Which produces log lines that look something like this:
 +
 +
[12-07-25 13:29:07.941] {main} Resin Professional 4.0.s120723 (built Mon, 23 Jul 2012 03:01:50 EDT)
 +
[12-07-25 13:29:07.941] {main}
 +
[12-07-25 13:29:07.941] {main} Mac OS X 10.6.8 x86_64
 +
[12-07-25 13:29:07.941] {main} Java(TM) SE Runtime Environment 1.6.0_33-b03-424-10M3720, MacRoman, en
 +
 +
This format isn't really ideal since it does not include the logger class name.  The logger class name not only tells you where the log line came from, but also is useful if you want to adjust particular log levels to filter unwanted lines.
 +
 +
In recent version, the packaged resin.xml include a more useful TTCC (Time Thread Category Component) style log-handler that's commented out.  I recommend you delete the default log-handler and uncomment this one:
 +
 +
<log-handler name="" level="all" path="stdout:"
 +
    timestamp="%y-%m-%d %H:%M:%S.%s"
 +
    format=" [${thread}] ${log.level} ${log.shortName} - ${log.message}"/>
 +
 +
Which produces log lines that look something like this:
 +
 +
12-07-25 13:36:02.587 [main] INFO ResinSystem - Resin Professional 4.0.s120723 (built Mon, 23 Jul 2012 03:01:50 EDT)
 +
12-07-25 13:36:02.587 [main] INFO ResinSystem -
 +
12-07-25 13:36:02.587 [main] INFO ResinSystem - Mac OS X 10.6.8 x86_64
 +
12-07-25 13:36:02.588 [main] INFO ResinSystem - Java(TM) SE Runtime Environment 1.6.0_33-b03-424-10M3720, MacRoman, en
 +
 +
So now we can see that these particular lines are produced by ResinSystem, one of the most important internal Resin classes.  Unfortunately that's not enough information for filtering, since we need the full classname with package to set a logger level. 
 +
 +
${log.shortName} is the class name with no package.  Changing this to ${log.name} will produce the full class name.  The full list of token is available in the Resin logging documentation here: http://www.caucho.com/resin-4.0/admin/logging.xtp .
 +
 +
12-07-25 14:14:38.377 [main] INFO com.caucho.env.service.ResinSystem - Resin Professional 4.0.s120723 (built Mon, 23 Jul 2012 03:01:50 EDT)
 +
12-07-25 14:14:38.377 [main] INFO com.caucho.env.service.ResinSystem -
 +
12-07-25 14:14:38.378 [main] INFO com.caucho.env.service.ResinSystem - Mac OS X 10.6.8 x86_64
 +
12-07-25 14:14:38.378 [main] INFO com.caucho.env.service.ResinSystem - Java(TM) SE Runtime Environment 1.6.0_33-b03-424-10M3720, MacRoman, en

Revision as of 00:00, 25 July 2012

Gears-48.png

We often get asked how to enable additional logging to debug a particular Resin behavior

On this page I will provide example of alternative log formats, and list a few key internal classes that can produce helpful debugging logs.

Log Format

Resin's default log format (as of 4.0.29) is the following:

<log-handler name="" level="all" path="stdout:"
   timestamp="[%y-%m-%d %H:%M:%S.%s]"
   format=" {${thread}} ${log.message}"/>

Which produces log lines that look something like this:

[12-07-25 13:29:07.941] {main} Resin Professional 4.0.s120723 (built Mon, 23 Jul 2012 03:01:50 EDT)
[12-07-25 13:29:07.941] {main} 
[12-07-25 13:29:07.941] {main} Mac OS X 10.6.8 x86_64
[12-07-25 13:29:07.941] {main} Java(TM) SE Runtime Environment 1.6.0_33-b03-424-10M3720, MacRoman, en

This format isn't really ideal since it does not include the logger class name. The logger class name not only tells you where the log line came from, but also is useful if you want to adjust particular log levels to filter unwanted lines.

In recent version, the packaged resin.xml include a more useful TTCC (Time Thread Category Component) style log-handler that's commented out. I recommend you delete the default log-handler and uncomment this one:

<log-handler name="" level="all" path="stdout:"
    timestamp="%y-%m-%d %H:%M:%S.%s"
    format=" [${thread}] ${log.level} ${log.shortName} - ${log.message}"/>

Which produces log lines that look something like this:

12-07-25 13:36:02.587 [main] INFO ResinSystem - Resin Professional 4.0.s120723 (built Mon, 23 Jul 2012 03:01:50 EDT)
12-07-25 13:36:02.587 [main] INFO ResinSystem - 
12-07-25 13:36:02.587 [main] INFO ResinSystem - Mac OS X 10.6.8 x86_64
12-07-25 13:36:02.588 [main] INFO ResinSystem - Java(TM) SE Runtime Environment 1.6.0_33-b03-424-10M3720, MacRoman, en

So now we can see that these particular lines are produced by ResinSystem, one of the most important internal Resin classes. Unfortunately that's not enough information for filtering, since we need the full classname with package to set a logger level.

${log.shortName} is the class name with no package. Changing this to ${log.name} will produce the full class name. The full list of token is available in the Resin logging documentation here: http://www.caucho.com/resin-4.0/admin/logging.xtp .

12-07-25 14:14:38.377 [main] INFO com.caucho.env.service.ResinSystem - Resin Professional 4.0.s120723 (built Mon, 23 Jul 2012 03:01:50 EDT)
12-07-25 14:14:38.377 [main] INFO com.caucho.env.service.ResinSystem - 
12-07-25 14:14:38.378 [main] INFO com.caucho.env.service.ResinSystem - Mac OS X 10.6.8 x86_64
12-07-25 14:14:38.378 [main] INFO com.caucho.env.service.ResinSystem - Java(TM) SE Runtime Environment 1.6.0_33-b03-424-10M3720, MacRoman, en
Personal tools
TOOLBOX
LANGUAGES