From Resin 3.0

Revision as of 20:22, 21 February 2006 by Sam (Talk | contribs)
Jump to: navigation, search

The <log> directive configures java.util.logging output. It can appear in any Environment.



By convention, the name of a logger is the class of the Java file that's logging, e.g. "com.caucho.server.port.Port".

attribute meaning default
name logging name required
level java.util.logging level info
timestamp a timestamp to be used for logging none
use-parent-handlers if true, also write to the parent true
handler add a custom handler
formatter add a custom formatter
mbean-name save in jmx
path output path (see above) required
path-format formatted path (see above)
archive-format format of the archive (see above)
rollover-period how often to rollover (see above)
rollover-size how large a file before rolling over (see above)

The timestamp uses the Date Format Configuration syntax.

Example Logging Usage

package com.foo;

import java.util.logging.Logger;

public class Test {
  private static final Logger log
    = Logger.getLogger(Test.class.getName());

  public void doStuff()
    log.fine("doing stuff");

<resin xmlns="http://caucho.com/ns/resin">
  <log name="com.foo" level="fine" path="log/debug.log"
       timestamp="[%H:%M:%S] "/>

Logging Level Conventions

Conventions on logging levels:

level use
warning fatal errors
info information for a typical install
fine debug information useful for users
finer debug information useful for developers

For example, level="fine" for "com.caucho" will give the information most generally useful for Resin uses, while level="finer" will add more information that's more detailed for the Caucho developers. level="info" is infrequent, giving significant information like the server starting.

Log Names

  1. redirect Resin logging names

Specifying Logs For Different Environments

Resin lets you configure individual logs for each environment, e.g. separate logs for <web-app> or <host>. To enable the logs, just add the <log> directive in the environment.


<web-app xmlns="http://caucho.com/ns/resin">
   <log name="com.caucho.server.webapp"

Personal tools