You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Johannes <to...@fwd.at> on 2004/02/06 21:11:08 UTC
Logging / Exception handling framework within Tomcat
hi there,
As of TC 4.x I know the following architecture exists for logging within
an application:
>From the very basic
*) System.out.println, which goes to catalina.out / stdout.log
*) e.printStackTrace(), which goes to catalina.out / stderr.log
up to more advanced:
*) using context.log() to write into the servlet context's log file
*) using Log4J to redirect log output to files / jdbc interfaces
However, in real life I found these approaches are very basic and not
sufficient:
*) If I want to debug, I usually want to debug complete transactions = I
want to know what was stored inside the request, where did it come from,
what was the content of the session, and what was the complete debug
logging of the whole transaction (including all methods called / walked
through).
I wrote a small framework to handle such transaction debug logs
completely. Is anybody else interested in this issue?
*) If an exception arises, the stacktrace in catalina.out is a nightmare
to troubleshoot. To be productive in detecting runtime exceptions, one
needs a complete transaction log to know exactly what happened.
Complete transaction log means to me:
- complete data of the HttpServletRequest
- complete data of the HttpSession
- everything that might identify the user (Cookies, RemoteAddress,
Browser, ...)
- complete stacktrace
Additionally, I needed to turn on/off debugging during RUNTIME, which
currently is not supported using Log4J (because it stores its data inside
properties files within the WAR file). I wrote a small Singleton to
support turning logging ON/OFF during runtime.
I'd appreciate if anybody else can share his thoughts on this topic. Maybe
Log4J/the JDK Logging API provides options that I don't know of yet.
thx
Johannes