| From | Sent On | Attachments |
|---|---|---|
| Robert Elliot | Oct 30, 2008 5:02 am | |
| Ceki Gulcu | Oct 30, 2008 6:24 am | |
| Robert Elliot | Oct 30, 2008 6:31 am | |
| Ceki Gulcu | Oct 30, 2008 6:51 am | |
| Robert Elliot | Oct 30, 2008 6:59 am | |
| Ceki Gulcu | Oct 30, 2008 7:36 am | |
| Robert Elliot | Oct 31, 2008 7:29 am | |
| Robert Elliot | Oct 31, 2008 7:29 am |
| Subject: | [logback-user] Set Level per Logger AND Appender? | |
|---|---|---|
| From: | Ceki Gulcu (lis...@qos.ch) | |
| Date: | Oct 30, 2008 6:51:19 am | |
| List: | ch.qos.logback-user | |
I see. You could attach an evaluator fiter which can filter events based on criteria that you decide upon. For example,
<filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator name="myEval"> <expression> (logger.getName().contains("logger names...") && level > INFO) || (level > WARN) </expression> </evaluator> <OnMismatch>DENY</OnMismatch> <OnMatch>ACCEPT</OnMatch> </filter>
where "logger names ..." stands for loggers needing special handling.
I am not 100% the above expression is error free but it should at least get my point across. In particular, you need to write & as & in an XML file. So '&&' would become '&&'.
Does the above help?
Robert Elliot wrote:
Because for some loggers I want INFO level statements to be written to application.log (for instance in the case of server startup / shutdown) and for some loggers I don't. If I set a filter on the appender to only allow WARN or higher to application.log I lose all the INFO statements I wanted- if I set it to allow INFO or higher then if I set a logger to DEBUG then it will start sending INFO messages that I don't want to application.log.
-- Ceki G?lc? Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch





