logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Wannamaker <Mike.Wannama...@KINGSTON.Hummingbird.com>
Subject RE: Log4J: System.out and System.err
Date Thu, 14 Jul 2005 20:06:04 GMT
I don't want to send to, I want to capture.  We have applications that are
writing to System.out and System.err and I want to capture those and log
them to a Logger.

What I've done is this:

	private static void setupLoggerOutputStreams()
	{
		ComponentLogger logger = new ComponentLogger(null);
		PrintStream err = new LoggerStream(logger, true);	//
true - because we want the err stream to always be on
		PrintStream out = new LoggerStream(logger, false);	//
false - because we want normal output to be controled by the filters
		System.setErr(err);
		System.setOut(out);
	}

Although I still get some exceptions etc being logged to the console window?

--ekiM

-----Original Message-----
From: Javier Gonzalez [mailto:jagonzal@gmail.com] 
Sent: July 14, 2005 3:26 PM
To: Log4J Users List
Subject: Re: Log4J: System.out and System.err

Don't know about capturing System.out or System.err, but the 
ConsoleAppender can be created with the property Target set to
System.out or System.err for logging to the desired stream

-- 
Javier Gonzalez Nicolini

---------------------------------------------------------------------
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