Apache » Cocoon »

  Cocoon Core
      2.2
   homepage

Cocoon Core 2.2

Logging configuration

Introduction

Cocoon uses Log4j library for logging and uses it quite extensively so log files can be very valuable source of information how things are performed. There are five standard log levels to choose in order to limit amount of information dumped to log files:

  • FATAL_ERROR
  • ERROR
  • WARN
  • INFO
  • DEBUG
In production environment it is reasonable to set a log level to ERROR or FATAL_ERROR so only very important events are logged (like crashes). While developing an application you would probably like to see much more. It's up to you to choose an approporiate log level; little experimantation will give you sense of each setting.

Tweaking the configuration

Configuration in Cocoon is handled by Spring configurator, go there for general information.

How to set up a log level

Note: Instructions put below assume that you have created a block according to this tutorial. Please refer to it, first.
Steps that you need to perform:
  1. create a properties subfolder in your block:
    myBlock1/src/main/resources/META-INF/cocoon/properties
  2. create a new file in that folder that should have as ending .properties, e.g. settings.properties
  3. inside that file you have to put this line if you want to set log level to DEBUG:
    org.apache.cocoon.log4j.loglevel=debug
That's all! Restart your webapp and you should see now a detailed log information in a file in:
myBlock1/target/work/log/log4j.log