Hello, I've been looking at a seemingly simple problem I can't figure out the solution for - hope it's something you've encountered before.
I have test code that recursively calls certain routines which emit quite a bit of logging to the console. I'd like to temporarily switch the logging configuration to one that is less chatty, but restore the previous configuration afterward (as if nothing changed). Everything is single-threaded. I looked at the LoggerContext and its reconfigure(Configuration) and setConfiguration(Configuration) methods, thinking something like this would work: 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 will spare you the code as none of them worked properly. Any help or pointers would be greatly appreciated. Dawid --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org