Logging

Application Log

Log Levels

The log.application.level configuration key specifies the severity threshold beneath which log messages will be discarded. Available values, in order of severity, are: trace, debug, info, warn, and error. Additionally, all can be used to log absolutely everything, and off to log nothing.

Message Formats

Every incoming request is handled on a separate thread, and is logged at INFO level:

Time         Thread ID         Level Class Name                   Message
13:54:12.084 [qtp795326519-32] INFO  e.i.l.c.r.AbstractResource - doInit(): handling GET ...

As the request is processed, additional log messages are generated by various components, and most of them will have the same thread ID, which is the best way to associate them with the initial request, especially when messages are arriving from multiple simultaneous requests.

The completion of every request is logged at DEBUG level:

13:54:12.405 [qtp795326519-32] DEBUG e.i.l.c.r.HandlerServlet - 110 msec total ...

The thread is then returned to its pool, from which it can be reused by a future request. Its ID never changes.

Appenders

Appenders direct log messages to various destinations, like files and/or the console. (The default configuration file logs only to the console.) There are several available appenders, which can be enabled or disabled in any combination.

ConsoleAppender

ConsoleAppender logs to the console. Set the log.application.ConsoleAppender.enabled configuration key to true or false to enable or disable.

FileAppender

FileAppender logs to a single file. Use the log.application.FileAppender.enabled key to enable or disable, and the log.application.FileAppender.pathname key to set the absolute pathname of the log file.

RollingFileAppender

RollingFileAppender logs to a file that rolls over periodically (to avoid creating a single huge file). Use the log.application.RollingFileAppender.enabled key to enable or disable, and the log.application.RollingFileAppender.pathname key to set the absolute pathname of the primary log file.

Currently, the only available rolling policy (log.application.RollingFileAppender.policy) is TimeBasedRollingPolicy, which rolls over the log file based on the value of log.application.RollingFileAppender.TimeBasedRollingPolicy.filename_pattern. log.application.RollingFileAppender.TimeBasedRollingPolicy.max_history defines how many rolled-over log files will be kept.

FileAppender and RollingFileAppender should not be set to log to the same file.

SyslogAppender

SyslogAppender appends log messages to the syslog.


Error Log

The error log is a dedicated log for WARN- and ERROR-level application log messages. This log offers a FileAppender and RollingFileAppender that work the same as their application log counterparts.

Whether or not any error log appenders are enabled, error messages will still appear in the application log.


Access Log

Access logs are written in the Common Log Format. To enable the access log, set the value of log.access.ConsoleAppender.enabled to true. If you are running behind a reverse proxy server, this one may be redundant.

Access log appenders work the same as application log appenders.