logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender Heri" <HBen...@Ergonomics.ch>
Subject RE: [SPAM (Bayesain Analysis)] - Newbie help: Capturing Stdout and Stderr into log4j - Bayesian Filter detected spam
Date Thu, 29 Nov 2007 09:06:24 GMT
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:sriharsha.chevuru@wachovia.com]
> 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: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message