[logback-user] dynamically change logging thesholds

Ceki Gülcü ceki at qos.ch
Wed Feb 9 10:26:46 CET 2022

Hi Norbert,

Short responses inline.

On 2/9/2022 1:46 AM, Norbert Kiesel wrote:
> Hi,
> we often need to change log level thresholds to investigate a problem in
> a running system. Right now, we do that by using
> <configuration  scan="true" scanPeriod="30 seconds">
> and then editing the logback.xml file by hand (i.e. using a text editor
> or Sed or Perl).  I wonder if there is a better way to accomplish this. 
> I know that we can e.g. use
>   <root level="${rootLevel}"/>
> but what I do not yet understand is:
>  1. Can I modify the value if this variable via some Java API from
>     within my application?


>  2. Do we still need the |scan="true"|​ attribute or will the
>     "rootLevel" variable be evaluated every time the logger is used?

No and no.

>  3. Is there a measurable performance impact by using variables in that
>     manner?

It is not possible to reevaluate ${rootLevel} at each logger call as
such a feature would have had an enormous impact on performance.

Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch

More information about the logback-user mailing list