Remy Maucherat wrote:
>>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. :-)
>>
>
> There's a (small) problem. The new compiler (needed for Jasper 2) and Ant
> require that the Sys.err (and/or Sys.out) is captured to actually display
> error messages.
> That proposal must be modified to allow temporarily capturing a thread's
> Sys.out output, and put it in a String (in addition to the logging features
> you mentioned).
>
> Since this class is needed in Jasper (for other components, it's just an
> enhancement), it must be independent of Catalina (your proposal seems to be
> ok for that) and should be put in j-t-c/util.
>
> To summarize, that's a great timing for your proposal (I have the Ant
> compiler working at the moment, but I still need to do the output capture)
> :)
>
How is Ant implemented within Tomcat for doing JSP compiles?
I am concerned about Ant running within the same JVM and having to capture
the JVM's System.out and System.err. Other output from catalina could get
intermixed with the Ant output. Also I saw something about synchronizing
of compiles being required.
> Remy
>
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]>