First: You're on the wrong mailing list. This is the developper list. Ask such questions on the users list. Second: you cannot intercept System.out.print by log4j. Your example does the opposite: it writes log statements (e.g. myLogger.debug( "message" )) to an appender called stderr and stdout. In order to intercept System.out.print you have to replace the OutputStream by an own one and then do something with it. Heri
-----Ursprüngliche Nachricht----- Von: pudsinuk [mailto:[email protected]] Gesendet: Donnerstag, 21. Januar 2010 18:19 An: [email protected] Betreff: stdout in configuration Hello I am trying to send stdout (system.out.println) through to the log4j logger but i dont want to use an extra configuration file. I know there is a way to do this through an external file with a line like: "log4j.rootCategory = DEBUG, stderr, stdout" but i would just like to do this in a class I have the following in my class: public class Util_Logger{ static Logger logger = Logger.getRootLogger(); static{ FileAppender appender = new FileAppender(new SimpleLayout(), LOG_LOCATION); logger.addAppender(appender); logger.setLevel(LEVEL.ERROR); } } somebody help please?? -- View this message in context: http://old.nabble.com/stdout-in-configuration-tp27261344p27261344.html Sent from the Log4j - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
