
Are you at all familiar with Joran? See [1] for documentation. The AppenderRefAction class in the ch.qos.logback.core.joran.action package shows what the steps taken when an "apprend-ref" element is encountered. See [2] for the actual code. However, if you wish to encapsulate only one single appender within AsyncAppender, then your job should be quite easy. You don't need to get an appender by name. to Just declare a property called "appender" of type ch.qos.logback.core.Appender and let Joran's implicit actions take care of all the details. For implicit actions see [3]. The configuration would look like: <appender name="async" class="logback.AsyncAppender"> <bufferSize>20</bufferSize> <!-- nested appender configuration goes here --> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout> <pattern>%d %logger{36} - %msg%n</pattern> </layout> </appender> </appender> Once that works, you could deal with multiple appenders. (Just ask here again.) HTH, [1] http://logback.qos.ch/manual/onJoran.html [2] http://logback.qos.ch/xref/ch/qos/logback/core/joran/action/AppenderRefActio... [3] http://logback.qos.ch/manual/onJoran.html#implicit Cheenu wrote:
Seems something simple enough. But I can't figure out - any of you mind telling me?
Thanks
On Mar 2, 2009, at 2:00 PM, Cheenu wrote:
I am trying to develop a new appender for Async logging - a non-blocking appender similar to http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/AsyncAppender.h...
Config is like: <appender name="async" class="logback.AsyncAppender"> <bufferSize>20</bufferSize> <appender-ref ref="stdout" /> <appender-ref ref="file" /> </appender>
Question: How do I get list of appenders (the appender-ref's) in my code?
Thanks
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch