Hi Andrew,
 
Thanks for the tip.
However, I should have been more clear. I really *do* want to change the logging level.
 
Deployment&maintenance is done by third party, hence they decide what should be visible at each level (wish that wasn't the case, but...)
Also, it means removing the appender for some cases, e.g.if I want to 'upgrade' an error to WARN & add a specific 'WARN' appender, it works. However, when I only want to see ERROR I also have to remove the appender. Now I know that, but as said, maintenance is not done by me...
 
Regards,
 
Koos
 


Van: logback-user-bounces@qos.ch [mailto:logback-user-bounces@qos.ch] Namens Andrew Bourgeois
Verzonden: vrijdag 7 september 2012 18:47
Aan: logback users list
Onderwerp: Re: [logback-user] Modifying a logging events' level

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

======================================================
Rabobank disclaimer: http://www.rabobank.nl/disclaimer