Config: Important Loggers
From Resin 4.0 Wiki
Contents |
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 Formats
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
Loggers
The packaged resin.xml include 3 loggers:
<logger name="" level="${log_level?:'info'}"/> <logger name="com.caucho.java" level="config"/> <logger name="com.caucho.loader" level="config"/>
The log_level variable comes from resin.properties and defaults everything to info level, with com.caucho.java and com.caucho.loader at a slightly more higher level.
It's important to notice there's also a level on log-handler! The log-handler level is the maximum level that will be accepted, regardless of what level is set for a logger. That means that even if you sent FINE level on a logger, if the log-handler level is set to INFO, it will only get log INFO level and lower.
The full list of log levels is available in the Resin documentation here: http://www.caucho.com/resin-4.0/admin/logging.xtp
Much of the logging Resin produces above INFO level is for our own debugging purposes and does not mean much to end users except in case of a Resin bug. Often submitting a bug report with high level logging of com.caucho is the most useful data we receive. However there's still some classes and packages that produces helpful logs when FINE, FINER, or FINEST logging is enabled.
Logging File Modifications
<logger name="com.caucho.vfs.Depend" level="fine"/>
HTTP Requests with Headers
<logger name="com.caucho.server.http.HttpRequest" level="fine"/>
HTTP Responses with Headers
<logger name="com.caucho.server.http.HttpResponse" level="fine"/>
WebApp Resources and Path Mapping
<logger name="com.caucho.server.webapp.WebApp" level="finest"/>