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

Robert Elliot rob at lidalia.org.uk
Fri Oct 5 20:21:06 CEST 2012

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

More information about the Logback-user mailing list