Jim,

How about creating a PrintStream, say X, that captures System.err. You can 
do this by
invoking System.setErr(x) where x is an instance of X.

The print(String s) and println(String s) methods of X would then redirect 
to log4j by calling root.info(s) where root is the root category. I have 
not tried this but the idea has been suggested by a number of log4j users. 
Do you think that would work? Ceki

At 11:30 30.01.2001 -0500, you wrote:
>How are people capturing things being sent to System.err?  Prior to using
>log4j the solution was simple: I was logging out to a file and did a
>System.setErr(...) to a FileWriter to the file.
>
>Unfortunately, that doesn't work with log4j and it's a real problem.  I've
>created a ThreadGroup that my app runs in to capture exceptions that way,
>but there are other places -- like java.awt.EventDispatchQueue -- that
>bypass that mechanism.  (There's a hack [Sun's word] to capture exceptions
>in EventDispatchQueue, but that's only with JDK 1.2 and above.)  There's
>other places as well that like to simply spit out to System.err.  If I've
>got an SMTPAppender sending me messages, for example, it could easily be
>vitally important to debugging the problem to know that EventDispatchQueue
>had hit an OutOfMemoryException which is what generated the error that sent
>the email.
>
>Ideas?

----
Ceki Gülcü - Independent IT Consultant

av. de Rumine 5            Tel: ++41 21 351 23 15
CH-1005 Lausanne        e-mail: [EMAIL PROTECTED]  or
Switzerland                     [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to