[FrontPage] [TitleIndex] [WordIndex

How to use the log4j.properties file for debugging

1. log4j.properties file

The deegree2.jar contains a log4j.properties file. It is stored in the package org.deegree.framework.log.

You can overwrite the log setting from the deegree2.jar by copying the log4j.properties from inside the jar to the folder WEB-INF/classes, and editing this properties file to your needs.

There is some useful information on the logging mechanism inside this properties file. For every single detail, please refer to the official apache log4j manual.

2. How to change what is beeing logged

For instance, if you were running a deegree2 WPVS and you would like to see some debugging statements in your tomcat to find out about a specific problem, you would change the settings for WPVS:

  1. Search for "WPVS specific logging"
  2. comment in those lines that are appropriate for your specific case by removing the comment mark (#).
    For example, comment in the line

    • log4j.logger.org.deegree.ogcwebservices.wpvs=DEBUG

    and you will get all debug messages for WPVS service.

Please note:

  1. the logging mechanism works hierarchically.
    That means, that the first line will produce littel output,
    the second line will produce a lot more output and
    the third line will produce a ridiculously and unusable high number of log messages.

    log4j.logger.org.deegree.ogcwebservices.wpvs.WPVService=DEBUG
    log4j.logger.org.deegree.ogcwebservices.wpvs=DEBUG
    log4j.logger.org.deegree=DEBUG
  2. the most precise entry for a package determines the effective log level.
    This means that the following section will produce INFO logging for everything in package ogcwebservices.wpvs, and additionaly provide DEBUG logging for the included package WPVService.

    log4j.logger.org.deegree.ogcwebservices.wpvs=INFO
    log4j.logger.org.deegree.ogcwebservices.wpvs.WPVService=DEBUG

3. Where to find the logged information

The log4j.properties file contains an entry for log4j.rootLogger:

3.1. stdout

If stdout is listed for the log4j.rootLogger:

  1. make sure to have activated the section for log4j.appender.stdout

  2. if you started your tomcat with run, then all loggin statements which are being produced are printed to your Tomcat shell.
    if you started your tomcat with start, you will find the logging messages in one of the log files in tomcat's log directory tomcat_home/logs/ (often the file is named catalina.out or something like catalina.2009-07-02.log).

3.2. logfile

If logfile is listed for the log4j.rootLogger:

  1. make sure to have activated the section for log4j.appender.logfile

  2. the name of this logfile depends on the name of your tomcat context name. Let's say you are running a deegree WMS at http://localhost:8080/deegree-wms/service? then your tomcat context is deegree-wms and thus your log file is called deegree-wms.log.

  3. the name of the log folder depends on log.dir, which is set to $CATALINA_HOME by default, but could be changed to something more suitable for you.
    log.dir=${catalina.home}/logs
    log4j.appender.logfile.File=${log.dir}/${context.name}.log


CategoryDeegree2 CategoryHowTo


2018-04-20 12:04