Re: Having trouble changing a logger's level (threshold) at runtime

2023-02-28 Thread Ralph Goers
Looking at Configurator.setLevel(String loggerName, Level level) it should do exactly what I described - if there is no LoggerConfig with the name specified one will be created and have its level set. Otherwise it sets the Level on the located LoggerConfig. It then calls updateLoggers. If this

Re: Having trouble changing a logger's level (threshold) at runtime

2023-02-28 Thread Ralph Goers
What you are running into is a fundamental difference in how Log4j 1.x worked and how Log4j2 works. In Log4j 1 when you added a Logger statement to the configuration it would create a “real” Logger just as if you had called LogManager.getLogger(). Log4j 2.x does not do that. As Pier noted, this

Re: Having trouble changing a logger's level (threshold) at runtime

2023-02-28 Thread Gary Gregory
How about log4j-core's Configurator class and its setLevel() methods? Gary On Tue, Feb 28, 2023, 14:04 Christopher Schultz < ch...@christopherschultz.net> wrote: > All, > > I'm coming from a log4j v1.x background where this was easy to do: > > String loggerName = "com.example.Class"; > Logger

Re: Having trouble changing a logger's level (threshold) at runtime

2023-02-28 Thread Piotr P. Karwasz
Hi Chris, On Tue, 28 Feb 2023 at 20:04, Christopher Schultz wrote: > What is the recommended technique for changing a single logger's > threshold in log4j2? I realize that the best thing to do would be to > "just configure it correctly the first time" but in reality, you > sometimes just have to