How to make sense of the sometimes huge amount of information logged by Cocoon and Tomcat?
Where are the logs?
For a standard installation under tomcat there are two sets of logs (paths relative to TOMCAT_HOME):
- The Cocoon logs, found under ./webapps/cocoon/WEB-INF/logs
- The Tomcat logs, found under ./logs
Depending on the problem that you're trying to locate, you might have to look at both sets of files.
How to analyze the logs
The Cocoon and tomcat logs are plain text files, and as such best analyzed using text tools like those provided at the unix or linux command-line.
Unless you use something like LogFactorFiveHowto or ChainSaw, the logs must be analyzed with text-based tools.
Using the grep, cut, tail -f (and maybe awk) command-line utilities will help you a lot in finding what you're looking for. These tools are also available for Windows systems as part of the cygwin toolset.
Strong text editors like UltraEdit or TextPad might also help, but they're usually not as convenient as the console-based tools when it comes to real-time analysis of log files.
How to configure logging
- Cocoon 2.0.1 logging is configured in file ./webapps/cocoon/WEB-INF/logkit.xconf
- Tomcat 4.0.1 logging is configured in file conf/server.xml.
- For more details see ConfiguringTheLogs
Tips and tricks
- Emptying the log directories before reproducing the problem might help a lot: stop tomcat, empty both log directories, restart and do the minimum required to recreate the problem. This will greatly reduce the amount of information that you have to analyze.
- Look for changing timestamps on log files to find out which ones might contain the information that you're looking for. A logfile that grows when the problem that you're after occurs might contain the information that you're looking for.
- Use tail -f to look at log files in real time.
- Look for keywords in the log files. If you're after a problem with a database connection named foo for example, look for the word foo in the logs. Choosing names that are easy to find for items that you configure might help.