logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (LOG4J2-60) Ability to configure log level filtering on a per <appender-ref/> basis
Date Wed, 11 Jul 2012 20:23:34 GMT

     [ https://issues.apache.org/jira/browse/LOG4J2-60?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Ralph Goers closed LOG4J2-60.

Closing since there have been no other comments since this was marked resolved.
> Ability to configure log level filtering on a per <appender-ref/> basis
> -----------------------------------------------------------------------
>                 Key: LOG4J2-60
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-60
>             Project: Log4j 2
>          Issue Type: Wish
>          Components: Core
>            Reporter: Shane Kelly
>            Assignee: Ralph Goers
>            Priority: Minor
>             Fix For: 2.0-alpha1
> log4j 2's predecessor, log4j, supports the ability to filter log messages both at the
<logger/> and <appender/> level (where a <threshold/> has been specified).
This satisfies most typical scenarios, however I would find it very useful to have a slightly
finer degree of control, such that it is possible to define log level filters at the <appender-ref/>
level. Therefore for a given logger, you could have multiple <appender-ref/> definitions,
each with their own independent log level filter. I feel this would be useful in scenarios
where you wish messages for the same logger to be filtered independently depending on the
destination appender, and also the ability for two separate loggers to write to the same appender
at different log levels. A typical example might be were you have deployed a Web App and you
require it log only important messages by default, perhaps WARN and above, to the server console
(STDOUT) because you don't want to clutter it up with lots of details information - just the
important stuff, whilst logging much more verbose information to a separate rolling appender
- which could then be used for more complete analysis at a later date, should the need arise.
You might also have a second Web App (or a 3rd partly library which supports log4j/log4j 2)
which is configured to reuse some of all of the appenders detailed earlier, but with completely
independent log level filtering.
> To help illustrate the general concept I'm aiming for, I've included a pseudo-configuration
file below. You'll notice that I've omitted the LEVEL attribute from the <logger/> nodes
and added LEVEL attributes to each of
> the <appender-ref> nodes - this doesn't work in log4j obviously, but I was wondering
if there was some other way of emulating the behaviour that I'm after without cluttering up
the logback configuration too much...? You can see from the configuration that for com.myorg.myapp.subpackage.one
I would like to apply different log level restrictions depending on the destination appender.
You'll also notice that for com.myorg.myapp.subpackage.two I want to reuse the same appenders,
but also use different level restrictions.... hope that makes it clear enough...
> ---------
> <appender name="A">
>   ...
>   ...
> </appender>
> <appender name="B">
>   ...
>   ...
> </appender>
> <logger name="com.myorg.myapp.subpackage.one">
>   <appender-ref ref="A" LEVEL="INFO"/>
>   <appender-ref ref="B" LEVEL="DEBUG"/>
> </logger>
> <logger name="com.myorg.myapp.subpackage.two">
>   <appender-ref ref="A" LEVEL="WARN"/>
>   <appender-ref ref="B" LEVEL="TRACE"/>
> </logger>
> ----------

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message