listening on rolling events

Hi, Is there a way to add a listener to a RollingFileAppender so each time it rolls I can run some code in a call back function? Thanks. Yair

On 16.11.2011 14:47, Yair Ogen wrote:
Hi,
Is there a way to add a listener to a RollingFileAppender so each time it rolls I can run some code in a call back function?
You can have a StatusListener which will see all status messages, including those generated by rollover. Your listener can ignore all status messages except those pertaining to rollover. let us know if it the above works for you, -- Ceki

Hi Ceki, Thanks. I tried this but the only relevant event I see has this text: INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file As the listener runs in another thread I cannot guarantee that I can do my work. What I need to do is write a header (a dump of the current application configuration) and to make sure that in each new file this is the first thing on the file. Your solution makes it be somewhere at the beginning of the file but not necessarily the first thing. Any other ideas? Yair Ceki Gulcu wrote:
On 16.11.2011 14:47, Yair Ogen wrote:
Hi,
Is there a way to add a listener to a RollingFileAppender so each time it rolls I can run some code in a call back function?
You can have a StatusListener which will see all status messages, including those generated by rollover. Your listener can ignore all status messages except those pertaining to rollover.
let us know if it the above works for you,
-- Ceki _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- View this message in context: http://old.nabble.com/listening-on-rolling-events-tp32854850p32861639.html Sent from the Logback User mailing list archive at Nabble.com.

ANYONE? I really need to make this work. Yair yaog wrote:
Hi Ceki,
Thanks. I tried this but the only relevant event I see has this text:
INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file
As the listener runs in another thread I cannot guarantee that I can do my work. What I need to do is write a header (a dump of the current application configuration) and to make sure that in each new file this is the first thing on the file.
Your solution makes it be somewhere at the beginning of the file but not necessarily the first thing.
Any other ideas?
Yair
Ceki Gulcu wrote:
On 16.11.2011 14:47, Yair Ogen wrote:
Hi,
Is there a way to add a listener to a RollingFileAppender so each time it rolls I can run some code in a call back function?
You can have a StatusListener which will see all status messages, including those generated by rollover. Your listener can ignore all status messages except those pertaining to rollover.
let us know if it the above works for you,
-- Ceki _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- View this message in context: http://old.nabble.com/listening-on-rolling-events-tp32854850p32981419.html Sent from the Logback User mailing list archive at Nabble.com.

Does anyone have an idea other than Status Manager which does not work. As a reference, I am looking for something similar to the feature supported in: http://www.simonsite.org.uk/javadoc/org/apache/log4j/appender/TimeAndSizeRol...) In the above, the listener can write the the new file (after the roll) - before any other logger will write to the new file. This is exactly what I need. Thanks, Yair On Wed, Nov 16, 2011 at 15:47, Yair Ogen <yairogen@gmail.com> wrote:
Hi,
Is there a way to add a listener to a RollingFileAppender so each time it rolls I can run some code in a call back function?
Thanks.
Yair
participants (3)
-
Ceki Gulcu
-
Yair Ogen
-
yaog