Howdy,
You need to read the log4j documentation: that framework is far from
basic, very complete, and meets all your requirements.
Log4j supports modifying properties at runtime. You can write your own
code following instructions to do this, or you can use the log4j
sandbox's configuration servlet.
Log4j also supports adding contextual information to every log message.
There are several approaches possible here, but MDC
(org.apache.log4j.MDC) is probably what you want.
If you have further specific questions feel free to ask on the
log4j-user mailing list.
Yoav Shapira
Millennium ChemInformatics
>-Original Message-
>From: Johannes [mailto:[EMAIL PROTECTED]
>Sent: Friday, February 06, 2004 3:11 PM
>To: [EMAIL PROTECTED]
>Subject: 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
This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged. This
e-mail is intended only for the individual(s) to whom it is addressed, and may not be
saved, copied, printed, disclosed or used by anyone else. If you are not the(an)
intended recipient, please immediately delete this e-mail from your computer system
and notify the sender. Thank you.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]