Logging

From Resin 3.0

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


Contents

Access logging

Main article: access-log

An access log is a log that receives output describing each request received by the server. It is commonly used in conjunction with analyzing tools to determine statistics and patterns of use for a website.

Examples

<access-log path="logs/access.log"
            format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
            rollover-period="1W"/>


stdout-log and stderr-log

Main article: stdout-log
Main article: stderr-log

The stdout-log and stderr-log directives capture and redirect the output of System.out and System.err.

Examples

resin.conf configuration to capture Sysyem.out and System.err output to log files.


<resin xmlns="http://caucho.com/ns/resin"
       xmlns:resin="http://caucho.com/ns/resin/core">

  <stdout-log path='/var/log/foo/stdout.log'
              rollover-period='1W'/>
  <stderr-log path='/var/log/foo/stderr.log'
              rollover-period='1W'/>
 
  ...


log

Main article: log

Java programs (including Resin) can use the logging facilities included in the JDK. Log messages have a name and and a level.

Some Resin logging names have been documented.

Examples

Capture finer logging and display it on the console, useful during development:


<resin>
  ...
  <log name="" level="finer" path="stdout:"/>
  ...
</resin>


Rollover directives

Main article: Rollover

Rollover directives indicate that log files should be rolled over to new names at specified frequencies, breaking ever growing log files into manageable chunks.

Archiving directives

Main article: Archiving

archive-format and path-format are two mutually exclusive methods for archiving logs.

path-format specifies the name of a file to write the log to, and the name contains date format escape sequences that are replaced with the current date and time.

...
<host id="www.foo.com">
   <access-log path-format="/var/www/log/%Y/%m/%d.access.log"
               rollover-period="1D"/>
   ... 
</host>
...

archive-format first writes to a file specified by path, and then copies the file to the archive name at rollover time.

The file specified wth archive-format contains date format escape sequences that are replaced with the current date and time.

archive-format can use a *.gz or *.zip extension to indicate that the archived log should be compressed.

<access-log path="log/access.log"
            archive-path="/var/www/log/access.log.%Y%m%d.gz"
            rollover-period="1D"/>

See also

Redirecting standard output 
Personal tools