caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

Getting Started
Configuration
IDE
Topics
JSP
XML/XSLT

Basic Config
Directory
Servlets
Filters
Resources
Databases
Messaging
Security Config
Log Config
Taglib Config
Misc resin.conf
Host resin.conf
Port resin.conf
App resin.conf
Summary
Glossary
Index
 Log Configuration

JSSE
Configuration
Taglib Config

  1. Log Paths

stdout-log

Configures the destination for System.out. Each <host> and <web-app> can have its own individual System.out location.

AttributeDescriptionDefault
id (or href)Filesystem path for the streamrequired
rollover-periodhow often to rollover the log. Normally in days (15D), weeks (2W) or months (1M).none
rollover-sizemax size of the log before a rollover in bytes.1 meg

The following example configures System.out for a host. All web-apps in the host will write to the same output file.

...
<host id='foo.com'>
  <stdout-log href='/var/log/foo/stdout.log'
              rollover-period='1W'/>

  ...
</host>
...

stderr-log

Configures the destination for System.err. Each <host> and <web-app> can have its own individual System.err location.

AttributeDescriptionDefault
id (or href)Filesystem path for the streamrequired
rollover-periodhow often to rollover the log. Normally in days (15D), weeks (2W) or months (1M).none
rollover-sizemax size of the log before a rollover.1 meg

The path href may use path and regular expression variables.

The following example configures System.err for a host. All web-apps in the host will write to the same output file.

...
<host id='foo.com'>
  <stderr-log href='/var/log/foo/stderr.log'
              rollover-period='1W'/>

  ...
</host>
...

access-log

The access-log configures the logging of each request.

The access-log can be configured either in the <http-server>, <host>, or <web-app> context. It will apply within the context.

AttributeDescriptionDefault
idThe access log path.required
formatAccess log format.see below
rollover-periodhow often to rollover the log. Normally in days (15D), weeks (2W) or months (1M).none
rollover-sizemax size of the log before a rollover in bytes.10 meg
class-nameClass implementing AbstractAccessLog for custom logging.none
init-paramParameters for the custom log.none

The access log formatting variables follow the Apache variables:

%bresult content length
%hremote IP addr
%{xxx}irequest header xxx
%{xxx}oresponse header xxx
%{xxx}ccookie value xxx
%nrequest attribute
%rrequest URL
%sstatus code
%{xxx}trequest date with optional time format string.
%Ttime of request in seconds
%uremote user
%Urequest URI

The default format is:

"%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

<host id=''>

  <access-log id='log/access.log'>
    <rollover-period>2W</rollover-period>
  </access-log>

 ...

</host>

The class-name attribute allows for custom logging. Application can extend a custom class from com.caucho.http.log.AbstractAccessLog. The init-param parameters set bean parameters in the custom class.

...
<host id='foo.com'>
  <access-log href='$server-root/foo/error.log'
             rollover-period='1W'
             class-name='test.MyLog'>
    <init-param foo='bar'/>
  </access-log>
  ...
</host>
...

error-log

The error-log configures the destination for ServletContext.log() messages. The error-log is also used for exceptions not caught by the application.

The error-log can be configured either in the <http-server>, <host>, or <web-app> context. It will apply within the context.

AttributeDescriptionDefault
idThe access log path.required
rollover-periodhow often to rollover the log. Normally in days (15D), weeks (2W) or months (1M).none
rollover-sizemax size of the log before a rollover in bytes.1 meg
class-nameClass implementing AbstractAccessLog for custom logging.none
init-paramParameters for the custom log.none

The class-name attribute allows for custom logging. Application can extend a custom class from com.caucho.http.log.AbstractErrorLog. The init-param parameters set bean parameters in the custom class.

...
<host id='foo.com'>
  <error-log href='$server-root/foo/error.log'
             rollover-period='1W'
             class-name='test.MyErrorLog'>
    <init-param foo='bar'/>
  </error-log>
  ...
</host>
...

log

Starts logging for debugging.

AttributeMeaningdefault
idName of debugging sectionnone
hrefDestination filenone
timestamptimestamp formatnone
rollover-counthow many rotated (href.n) logs to keep.2
rollover-periodHow often to rotate the log.none

For example, to log everything to standard error use:

<caucho.com>
  <log id='/' href='stderr:' timestamp="[%H:%M:%S.%s]"/>
  ...
</caucho.com>

log id valueMeaning
/Debug everything
/caucho.com/jspDebug jsp
/caucho.com/javaJava compilation
/caucho.com/xslXSL debugging
/caucho.com/tcp-server TCP connections
/caucho.com/thread Thread creation and deletion
/caucho.com/sql Database pooling
/caucho.com/http HTTP related information
/caucho.com/http/session HTTP sessions

The timestamp can include the following patterns:

PatternMeaning
%ashort weekday (mon, tue, ...)
%Along weekday (Monday, Tuesday, ...)
%bshort month (Jan, Feb, ...)
%Blong month (January, February, ...)
%clocale specific date
%dday of month
%H24-hour
%I12-hour
%jday of year
%mmonth
%Mminute
%pam/pm
%Sseconds
%smilliseconds
%Wweek of year
%wday of week
%y2-digit year
%Y4-digit year

Debugging uses the com.caucho.vfs.LogStream interface. A typical use is as follows

import com.caucho.vfs.*;

public class Foo {
  static WriteStream dbg = LogStream.open("/caucho.com/foo");

  ...
  void doFoo()
  {
    if (dbg.canWrite())
      dbg.log("executing foo");
  }
  ...
}

Log Paths

The path href may use path and regular expression variables.

VariableValue
$server-rootThe root of the server instance. Same as the -server-root argument.
$host-rootThe app-dir of the enclosing <host>
$app-dirThe app-dir of the enclosing <web-app>
$host0 ... $host9Regular expression replacement from a host url-regexp.
$app0 ... $app9Regular expression replacement from a web-app url-regexp.
$0 ... $9Regular expression replacement for the containing context (host or web-app)
$fooJava property value from System.getProperty("foo")


JSSE
Configuration
Taglib Config
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.