The other problem with logging is that messages logged without a trace level are not given a default trace level so there is no way to stop those messages from being displayed. Why are messages not given a default log level if they are not created with one.
John -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Glenn Nielsen Sent: Tuesday, May 21, 2002 8:01 AM To: [EMAIL PROTECTED] Subject: [PROPOSAL] Tomcat 4 System.err/System.out logging Problem ------- Frequently code running within a web application context will print to System.out, System.err, printStackTrace(), etc. This output ends up getting logged to catalina.out without any timestamps. When you have multiple virtual hosts/contexts it can be a pain to correlate the stack traces and other output in catalina.out with the web application context which generated it. Proposed Solution ----------------- 1. Create a JNDI named resource for the ServletContext (java:comp/env/context) scoped to the web application. 2. Create a custom PrintStream object which uses the above JNDI named resource to find which ServletContext to direct output to. If no context is found, it prints to the default System.err and System.out. If a ServletContext is found it uses its log method for output. 3. On Tomcat startup use System.setErr() and System.setOut() to replace the default PrintStream with the above custom PrintStream. Comments, suggestions, and alternate solutions are welcome. :-) Regards, Glenn ---------------------------------------------------------------------- Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder | MOREnet System Programming | * if iz ina coment. | Missouri Research and Education Network | */ | ---------------------------------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>