[slf4j-user] Muting a Logger

Randall Wood randall.h.wood at alexandriasoftware.com
Fri Feb 22 14:01:43 CET 2013


I have a program that I am converting from Log4J to SLF4J, and have some logic paths that, in a couple of situations, mute output from a single Logger in a method, and then restoring the Logger to the user-selected logging level at the end of the method.

Is there any way to temporarily disable output from a single Logger in SLF4J?

Currently I am getting around this by setting a flag in the class to disable logging, and wrapping every logging statement in the affected methods with an if statement testing that flag, but would prefer some other method if one is available.

Randall Wood
Alexandria Software
202.683.8604
randall.h.wood at alexandriasoftware.com
http://www.alexandriasoftware.com



More information about the slf4j-user mailing list