Helma Logo
main list history
previous version  overview  next version

Version 2 by hypersmil on 16. January 2008, 12:00

This page gives an overview of the logging infrastructure provided by Helma.

== Creating log messages from Helma apps

The *global app object|http://helma.zumbrunn.com/reference/app.html* provides several methods for generating log messages from Helma applications:

* *app.log()|http://helma.zumbrunn.com/reference/app.html#app.log*
* *app.debug()|http://helma.zumbrunn.com/reference/app.html#app.debug*
* *app.getLogger()|http://helma.zumbrunn.com/reference/app.html#app.getLogger*

== Helma application an and server logs

Java logging frameworks usually separate logging output by class or package name of the originating class. Helma extends this scheme by adding one server log and several per-application logs. The server log is called "helma.server". The default application logs are the event log and the access log, called helma.<appname>.event and helma.appname.access, respectively.

Additionally, Helma apps can be configured to log SQL statements issued by the Helma O/R layer using the logSql property in server.properties or app.properties:

  logSql = true

== Helma logging

Helma uses *Apache Commons Logging|http://commons.apache.org/logging/* to allow users to plug in different logging implementations. Helma comes with its own logging implementation, which is used by default and should be sufficient for many applications. It features asynchronous output for high performance logging, automatic daily log file rotation, and gzip compression of archived log files.

==== Logging Output

Helma logging can be configured to log to files, which by default are located in the log subdirectory of the Helma installation, or to the console, which is useful during development. This is controlled using the <b>logdir</b> option in server.properties or app.properties, which contains the path of the directory in which to put the log files.

  logdir = /var/log/helma/

If the logdir property is set to "console", logging output will be written to standard output stream (java.lang.System.out).

  logdir = console

If logdir is not set in system.properties or app.properties, log files will be written to the /log subdirectory of the Helma installation.

==== Log Levels

Apache Commons Logging supports six log levels: "trace", "debug", "info", "warn", "error" and "fatal". The default log level for Helma logging is "info", meaning that log messages with lower levels "debug" and "trace" will be ignored. The log level for Helma logging can be set using the helma.loglevel system property.

  java -Dhelma.loglevel=debug -jar launcher.jar

== Apache log4j

For those applications that require extended logging features, *Apache log4j|http://logging.apache.org/log4j/* is a very popular choice. There is a *Howto document|http://helma.org/docs/howtos/log4j/* for setting up Helma with log4j.

     removed
     added