Affects Version/s: 2.1
Fix Version/s: 2.4
I'm actually confused about the intention here, so this is more a question than a bug report, though I'm quite sure that something is wrong here.
I ran into this issue while writing unit tests for a custom layout and using InitialLoggerContext to setup my logging. I was expecting to always get a fresh start with my actual logger. And I always set a new custom PrintStream for System.out in order to capture the finished output.
That just worked once, even when I set "follow" ("If true will follow changes to the underlying output stream.") on the console appender, due to the caching in the AbstractManager/OutputSteamManager output.
The issue is that ConsoleAppender.getManager does the following:
OutputStreamManager.getManager(target.name() + '.' + follow, new FactoryData(os, type, layout), factory);
So the key that ends up in AbstractManager.MAP is something like "SYSTEM_OUT.true". ConsoleAppenders.ConsoleManagerFactory just uses data.type as the name for the manager, so this will be something like "SYSTEM_OUT" in this case.
But AbstractManager.release uses the "name" field of the Manager for removing from the map, thus an entry with "SYSTEM_OUT.true" will never be removed, which leads to the issue that changes to System.out will not be visible for the ConsoleAppender.