[logback-user] Passing logger level via parameter or determining programmatically?

Smith, Larry (ECS - Enterprise Cloud Service) larry.smith5 at hp.com
Fri Oct 5 21:06:05 CEST 2012


Hi Robert,

Took a quick look at the library. It's very close to what I was looking for. 



Larry Smith


-----Original Message-----
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] On Behalf Of Robert Elliot
Sent: Friday, October 05, 2012 11:21 AM
To: logback users list
Subject: Re: [logback-user] Passing logger level via parameter or determining programmatically?

There isn't anything native to SLF4J, but it's relatively trivial to implement using the decorator pattern. I've got a library here: http://GitHub.com/Mahoney/slf4j-utils - which does just this, and which I'm planning on releasing to Maven central pretty soon.

On 5 Oct 2012, at 17:29, "Smith, Larry (ECS - Enterprise Cloud Service)" <larry.smith5 at hp.com> wrote:

> Hi all,
> 
> Is there any way to accomplish setting a log level (error, warn, ...) via a parameter, so that I do not have to explicitly code logger.error(...), logger.warn(...)?
> 
> I would like to be able to code something like logger.log("foo={}", 
> foo); and have it determine the level based on a previously set value.
> 
> If I could do something like this, then I could change the logging level dynamically in specific classes, rather than changing the level for an entire class as I've seen discussed in the past.
> 
> Thanks,
> Larry Smith
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list