RE: [SCL-4] Intercepting LoggingEvent
Depends on the implementation of your renderer. The renderer is called only after log4j framework has decided that a logoutput will really occur, means that all checks on log levels of logger and appenders are already executed. Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Friday, November 26, 2010 2:41 PM To: log4j-user@logging.apache.org Subject: Re: [SCL-4] Intercepting LoggingEvent @Heri Do you think this could affect performance ? @Scott It looks like this is not part of 1.2.16 or extras. Git has the code though. -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent- tp30302884p30308920.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-4] Intercepting LoggingEvent
@Heri Do you think this could affect performance ? @Scott It looks like this is not part of 1.2.16 or extras. Git has the code though. -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent-tp30302884p30308920.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-4] Intercepting LoggingEvent
You're right, this is a part of the Receivers companion that is not yet officially released (that will be remedied hopefully very very soon). you can pull the source down and build it using maven. Scott On Fri, Nov 26, 2010 at 5:40 AM, Mohan.Radhakrishnan moh...@fss.co.inwrote: @Heri Do you think this could affect performance ? @Scott It looks like this is not part of 1.2.16 or extras. Git has the code though. -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent-tp30302884p30308920.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
RE: [SCL-4] Intercepting LoggingEvent
Write your own Renderer derivation which you can specify in xml configuration (assign to your specific class, see below). The Trick is that you pass a custom object to the log calls (the param need not to be a String, it is formally an object): MySpecificLogInfoHolder infos = new MySpecificLogInfoHolder() myLog.info( infos ); When the log4j framework comes to render (after having checked the levels etc.) it calls your custom renderer where you can render the output string as you like. Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Thursday, November 25, 2010 7:46 AM To: log4j-user@logging.apache.org Subject: [SCL-4] Intercepting LoggingEvent I am trying to intercept the LoggingEvent which is an instance of a custom LoggingEvent created by a library. I have a custom appender and also a filter but neither seems to be a clean way of extracting specific custom information for logging. I think there should be a way to log only what I want from the LoggingEvent by extracting it before the log is written. Is this feasible ? -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent- tp30302884p30302884.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org
Re: [SCL-4] Intercepting LoggingEvent
Look at RewriteAppender. I think you May be able to do what you need with that and a custom RewritePolicy. Scott On Nov 25, 2010, at 6:33 AM, Bender Heri hben...@ergonomics.ch wrote: Write your own Renderer derivation which you can specify in xml configuration (assign to your specific class, see below). The Trick is that you pass a custom object to the log calls (the param need not to be a String, it is formally an object): MySpecificLogInfoHolder infos = new MySpecificLogInfoHolder() myLog.info( infos ); When the log4j framework comes to render (after having checked the levels etc.) it calls your custom renderer where you can render the output string as you like. Heri -Original Message- From: Mohan.Radhakrishnan [mailto:moh...@fss.co.in] Sent: Thursday, November 25, 2010 7:46 AM To: log4j-user@logging.apache.org Subject: [SCL-4] Intercepting LoggingEvent I am trying to intercept the LoggingEvent which is an instance of a custom LoggingEvent created by a library. I have a custom appender and also a filter but neither seems to be a clean way of extracting specific custom information for logging. I think there should be a way to log only what I want from the LoggingEvent by extracting it before the log is written. Is this feasible ? -- View this message in context: http://old.nabble.com/Intercepting-LoggingEvent- tp30302884p30302884.html Sent from the Log4j - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org - To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org