What is xml-apis required for? If you need it then we have a problem.

Ralph

> On Nov 8, 2016, at 7:13 AM, Benson Margulies <[email protected]> wrote:
> 
> The need to add xml-apis to the dependency tree was also a bit of a surprise.
> 
> 
> On Tue, Nov 8, 2016 at 9:10 AM, Benson Margulies <[email protected]> wrote:
>> I read http://logging.apache.org/log4j/2.x/manual/migration.html which
>> is how I got into the neighborhood of
>> 
>> org.apache.logging.log4j.core.config.Configurator.setLevel
>> 
>> I can follow your recipe instead.
>> 
>> 
>> 
>> On Tue, Nov 8, 2016 at 9:05 AM, Ralph Goers <[email protected]> 
>> wrote:
>>> Are you looking at the Logger or LoggerConfig.  Log4j 2 separates Loggers 
>>> from their configuration.
>>> 
>>> To modify a logLevel you need to do:
>>> 
>>> LoggerContext context = (LoggerContext) LogManager.getContext(false);
>>> Configuration config = context.getConfiguration();
>>> LoggerConfig loggerConfig = config.getLoggerConfig(loggerName);
>>> loggerConfig.setLevel(level);
>>> context.updateLoggers();
>>> 
>>> This process locates the configured Logger for the desired logger name, 
>>> sets its level and then modifies all the Loggers that use the LoggerConfig.
>>> 
>>> Ralph
>>> 
>>>> On Nov 8, 2016, at 6:51 AM, Benson Margulies <[email protected]> wrote:
>>>> 
>>>> In old log4j, I've  maintained a JUnit rule that temporarily throttles a 
>>>> logger.
>>>> 
>>>> In log4j2, I see a setLevel, but no getLevel, which rather screws up
>>>> 'temporarily'.
>>>> 
>>>> What am I missing?
>>>> 
>>> 
>>> 
> 


Reply via email to