One easy way would be to write a PrintStream implementation (LoggingPrintStream, say) which issued logging statements. Then use System.setErr and System.setOut with your LoggingPrintStream.
However, I haven't used log4j much - as it didn't suit the needs of my application - so there are probably better ways of doing this within Log4J. -----Original Message----- From: Benjamin David [mailto:[EMAIL PROTECTED] Sent: 10 August 2005 11:45 To: [email protected] Subject: Redirecting stderr and stdout through log4j Hi, I am currently using log4j in an application to log my debug, info, error , etc messages to a file and all is fine, but I also need to log the output from stderr and stdout to the same file. I would like to take the stderr and stdout streams and feed them into log4j so they are sent to the same file than my debug, info, error messages, or something to that effect. Is there any way of doing this ? Thanks, --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
