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? >
