Log

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
[[Category:Configuration]]
 
[[Category:Configuration]]
  
= Tags =
+
The <log> tag configures [[java.util.logging]] output.  It can appear in any [[Environment]].
  
{| class="tags"
+
== tags ==
! name || description || default
+
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 || identifier for the log || required
+
||name||logging name||required
 
|-
 
|-
|| level || logging level for the log || info
+
||level||java.util.logging level||info
 
|-
 
|-
|| path || location for the log file || required
+
||timestamp||a timestamp to be used for logging||none
 
|-
 
|-
|| timestamp || timestamp format || 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)||
 
|}
 
|}
  
= Log Names =
+
The timestamp uses the [[Date Format Configuration]] syntax.
  
{| class="tags"
+
== Example Logging Usage ==
! name || description
+
 
 +
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] "/>
 +
  ...
 +
</resin>
 +
 
 +
== Logging Level Conventions ==
 +
 
 +
Conventions on logging levels:
 +
 
 +
{|
 +
||level||use
 
|-
 
|-
|| com.caucho.server.host || <[[host]]> logs
+
||warning||fatal errors
 
|-
 
|-
|| com.caucho.server.webapp || <[[web-app]]> logs
+
||info||information for a typical install
 +
|-
 +
||fine||debug information useful for users
 +
|-
 +
||finer||debug information useful for developers
 
|}
 
|}
  
= Specifying Logs For Different Environments =
+
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 ==
 +
 
 +
{{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> tag in the environment.
 
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> tag in the environment.

Revision as of 17:07, 3 January 2006


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

Contents

tags

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] "/>
  ...
</resin>

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

Template: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> tag in the environment.

resin-web.xml

<web-app xmlns="http://caucho.com/ns/resin">
   <log name="com.caucho.server.webapp"
           level="warning"
           path="WEB-INF/logs/error-log"/>

  ...
</web-app>
Personal tools