Apache » Cocoon »

  Cocoon Core

Cocoon Core 2.2


Fixme: There is a new, up-to-date document describing loggin configuration. Is there any valuable information to grab or could we remove this document?

Cocoon uses Commons Logging by default and provides support for using Log4j (through commons logging). The usual Cocoon web application sets up Log4j through the Cocoon Spring Configurator.

The default configuration for Log4j is in the global application context definition. Cocoon loads WEB-INF/cocoon/log4j.xconf as the configuration for Log4J. If you want to make any changes to the configuration file, it is advisable to not alter this default file but instead use your own configuration. Just change the reference in the application definition. This sample configuration file sets up Log4j to log all statements to a single log file in the temporary directory of the application server. The logging can be controlled in various ways as described below.

Overriding the log level

For development you can override the configured log level for your Log4J configuration by setting the property org.apache.cocoon.override.loglevel to the name of the level. For example this is very usefull to set the log level to debug for development purposes without changing the logging configuration.

Shielded Classloading

By default, Cocoon is configured to use shielded classloading. Therefore an own instance of Log4J is instantiated for just the Cocoon web application. If you want to share a global Log4J configuration between web applications, you have to turn off the shielded classloading for the whole Cocoon instance of for just Log4J.

Using your own logging system

If you want to use your own logging system instead of Log4J you can setup a Logger bean in the root application context of Spring. This bean must be registered with the name org.apache.avalon.framework.logger.Logger and it must conform to the interface with this name.