logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rabl, Christian" <cr...@init-ka.de>
Subject RE: Log4J: System.out and System.err
Date Fri, 15 Jul 2005 08:05:00 GMT
Mike,

did you overwrite *all* the print/println methods from PrintStream in
your LoggerStream class?
I have implemented the same functionality for our system and it's
working perfect for years.

/Christian

-----Original Message-----
From: Mike Wannamaker [mailto:Mike.Wannamaker@KINGSTON.Hummingbird.com] 
Sent: Thursday, July 14, 2005 10:06 PM
To: Log4J Users List
Subject: RE: Log4J: System.out and System.err

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


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