: var ctx = (LoggerContext) LogManager.getContext(false);
: var current = ctx.getConfiguration();
: try {
:   ctx.setConfiguration(myQuietConfiguration);
:   otherCode();
: } finally {
:   ctx.setConfiguration(current);
: }
: 
: But it doesn't. Neither with reconfigure nor with setConfiguration.
: The root logger's appenders are never reattached properly.
: 
: I wonder what I'm missing here. I've tried several other avenues but I

Dawid: The piece you're missing is LoggerContext.updateLoggers(...)

You can see examples of what you're describing in Solr's @LogLevel 
and ErrorLogMuter ...

https://github.com/apache/solr/blob/main/solr/test-framework/src/java/org/apache/solr/util/LogLevel.java
https://github.com/apache/solr/blob/main/solr/test-framework/src/java/org/apache/solr/util/ErrorLogMuter.java



-Hoss

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to