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:
- Search for "WPVS specific logging"
comment in those lines that are appropriate for your specific case by removing the comment mark (#).
For example, comment in the line
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
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.
3. Where to find the logged information
The log4j.properties file contains an entry for log4j.rootLogger:
log4j.rootLogger=INFO, stdout, logfile
If stdout is listed for the log4j.rootLogger:
make sure to have activated the section for log4j.appender.stdout
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).
If logfile is listed for the log4j.rootLogger:
make sure to have activated the section for log4j.appender.logfile
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.
- 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.