[logback-user] Logback - adding appenders

Jan Moravec jan.moravec at simplylance.com
Tue May 15 13:53:56 CEST 2012

Basically I want to intercept log messages produced by scheduled jobs (Quartz) running on the given JVM.


The idea is that one only plugs in the provided JVM agent JAR and the agent intercepts log messages from executed jobs and stores these together with other job related data in the configured db. Thus we will have a complete overview on when individual jobs started, finished, their results, exceptions and most importantly all the log messages logged by the individual execution threads. No need to touch the monitored applications and their configs. The agent does more things, but that is the part that is relevant to my question. 





From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of Thorbjørn Ravn Andersen
Sent: 15. května 2012 13:07
To: 'logback users list'
Subject: Re: [logback-user] Logback - adding appenders


What exactly is it you want to intercept? 


Is it to make an existing application using log4j or similar do something else?   


From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of Jan Moravec
Sent: 15. maj 2012 12:41
To: logback-user at qos.ch
Subject: [logback-user] Logback - adding appenders



I am building a JVM agent that needs to programmatically register a logback appender to intercept logging messages from a web-application(s) running on the given JVM. By using the JVM agent I can avoid modifying the web-application’s code & configuration. To make this work, I need to use byte-code instrumentation and in the class-loading phase modify some logback class(es) and inject my code that instantiates my (interception) appender and adds it to list of appenders associated with the root logger. What would be the best logback API class and method to instrument?  


Ideally it should be a class and method that:

·         Is called once upon every logback (re)initialization

·         Has been present in older logback versions.

·         Is public, stable and is not likely to disappear in future logback releases.


Thank you,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120515/8909617e/attachment.html>

More information about the Logback-user mailing list