hello Koos
I don’t know how to change the logging level itself, but I assume that what
you actually want to do is log these WARN messages with a configuration that has
the rootLogger configured at ERROR level.
If that’s the case, you can simply declare a separate logger for the
packages of that third-party library. In Groovy configuration that gives
us:
import ch.qos.logback.classic.encoder.PatternLayoutEncoder
import ch.qos.logback.core.FileAppender
import static ch.qos.logback.classic.Level.*
appender("someAppender", FileAppender) {
file = "/var/log/test/rootLog.log"
encoder(PatternLayoutEncoder) {
pattern = "%date{yyyy-MM-dd HH:mm:ss,SSS} [%thread] %-5level -
\\(%logger\\) - %message%n"
}
}
root(ERROR, ["someAppender"])
// =======================================================
// This is the logger that will allow WARN messages of your third-party
library to log its WARN messages (and above) to the same appender the rootLogger
is using.
// "logger(...)" documentation can be found here:
http://logback.qos.ch/manual/groovy.html
// =======================================================
logger("com.thirdparty.lib", WARN, ["someAppender"], false)
Best regards
Andrew Bourgeois
Sent: Friday, 07 September, 2012 18:24
Subject: [logback-user] Modifying a logging events'
level
Hi,
I'm in the situation where a 3rd party code logs some content at a certain
level, but I want that log to be a different (higher) level.
E.g: in my log: WARN : Connection to XYZ failed.
But I want: ERROR: Connection to XYZ failed.
Is there a way to do this with logback?
(couldn't figure it out… maybe with a separate appender?)
Regards,
Koos Gadellaa
======================================================
Rabobank
disclaimer: http://www.rabobank.nl/disclaimer
_______________________________________________
Logback-user mailing
list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user