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:[EMAIL PROTECTED] 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to