Log4j is not designed for hooking any system event. It's mainly a very flexible 
output channel. 
Capturing the stdout: Assign your own OutputStream to System.out and you get 
all messages to stdout. These you can write then to any logger you wish.
Exceptions are catched in the normal java way through try..catch. Within the 
catch block you would typically write
    myLog.error( "Exception catched in method XY", e );
Heri


> -----Original Message-----
> From: enthucoder [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 28, 2007 11:46 PM
> To: log4j-user@logging.apache.org
> Subject: [SPAM (Bayesain Analysis)] - Newbie help: Capturing 
> Stdout and
> Stderr into log4j - Bayesian Filter detected spam
> 
> 
> 
> Hi,
> 
> I am relatively new to log4j. Can anybody help me guiding 
> towards the best
> practice to achieve following?
> 
> 1.) How would i capture the Std out messages into log4j? (or 
> is it anything
> different than just embedding messages one wants to print 
> into logger....()
> method?)
> 
> 2.) Also there would be some exceptions or errors (would be 
> the right term I
> guess) which are unexpected like NullPointerException etc, 
> which usually
> leaked. How would one go about capturing these? 
> 
> Thanks in advance.
> .H
> -- 
> View this message in context: 
> http://www.nabble.com/Newbie-help%3A-Capturing-Stdout-and-Stde
rr-into-log4j-tf4893246.html#a14013050
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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

Reply via email to