[logback-dev] [JIRA] Commented: (LBCLASSIC-237) create a DelegateAppender which delegates all events to multiple child appenders
noreply-jira at qos.ch
Mon Dec 13 19:11:51 CET 2010
[ http://jira.qos.ch/browse/LBCLASSIC-237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11915#action_11915 ]
subes commented on LBCLASSIC-237:
I also looked at the SiftingAppender, but that one creates appenders on demand via an AppenderFactory, which is not actually what I want to achieve.
> create a DelegateAppender which delegates all events to multiple child appenders
> Key: LBCLASSIC-237
> URL: http://jira.qos.ch/browse/LBCLASSIC-237
> Project: logback-classic
> Issue Type: New Feature
> Components: appender
> Affects Versions: unspecified
> Reporter: subes
> Assignee: Logback dev list
> I'm using LogBack now since some time and got a config that suits me quite well, which i even modularized by merging multiple logback xml files to one and giving that as the configuration to logback. Thats needed because I am building a modular software productline with decentral configuration per module which have their own eclipse project.
> I have two default console appenders. One for System.out (level<=INFO) called "stdout" and another one for System.err (level>=WARN) called "stderr".
> On top of that I got two default log files. One for all the stuff that goes to both console appenders called "default" and another one for detailed error stacktraces called "error". I do that because I filter stacktraces for console but still want to have access to the complete stacktraces in another log file specific for that purpose. And beside those loggers my modules can create other file appenders like sql.log or messages.log and stuff.
> Now to my point: Because I have 4 appenders I almost always use together (2x console and 2x file), i have quite a lot of appender-refs I have to write on my logger definitions. To help with that, I would like to have an appender (called "common") which has the other 4 appenders as children like this:
> <appender name="common" class="...logback...DelegatingAppender">
> <appender-ref ref="stdout" />
> <appender-ref ref="stderr" />
> <appender-ref ref="default" />
> <appender-ref ref="error" />
> <!-- also nice would be to have a hidden appender that can't be directly used in loggers, but not actually required for my purposes -->
> <appender name="hiddenAndThusNameShouldNotBeNeeded" class="...SomeClass">
> <!-- ... some configuration ... -->
> With that I could either just put "common" on a logger to print to all 4 appenders or I would still have the flexibility to specify only one of those appers.
> I tried to implement this on my own, Implementing the appender class itself wasn't a problem, but I don't get how to make joran to understand the appender-ref and insert the delegate appender class into my DelegatingAppender via some setter. It would be nice if you could either include this as a feature into logback-classic or help me out writing it on my own. :)
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the logback-dev