JBoss's Log4jService loads the log4j.xml file, and then overwrites System.err/System.out to redirect to log4j. This used to work before 1.2.12 because the ConsoleAppender would always use the stream with which it was initialized. Unfortunately, with the fix of bug 31056 this trick no longer works, and an infinite loop is created. This seems like reasonable behavior to support, wanting to use the ConsoleAppender, but also wanting to redirect all System.out/err to the logging system. Perhaps a boolean flag can be added to ConsoleAppender such as "cacheTarget", so that in activateOptions() it behaves like 1.2.11 if cacheTarget is true, and 1.2.12 if cacheTarget is false. Thanks, Jasper
1.2.13 candidate
I think "followReassignment" or something containing "redirect" might be clearer than "cacheTarget". I don't think it would be good to have the behavior differ between versions and the 1.2.11 and earlier behavior should be the default (that is followReassignment=false) at least in the 1.2.x series. It would be possible to attempt to detect the JBoss redirection class, but I think that would not be a good solution since other applications may want to do the same thing. I don't think it would be possible to implement followReassignment=false in log4cxx. Don't know about the other log4X's. I think it would be better to associate the changes with this bug than continue work on 31506.
We can have the 1.2.X behavior be consistent (ie restore previous behavior with options to change the behavior with a flag), but then do the "right" thing in 1.3 going forward. Just so long as we document it, it should be fine, I think.
Fixed in SVN revision 326604 (trunk) and 326599 (v1_2-branch). Added honorReassignment attribute to configuration with default value of false (1.2.12 behavior).
Fix is in the 1.2.13rc1 build which can be located at http://cvs.apache.org/builds/logging/log4j/log4j-1.2.13rc1/. Please check the fix and let us know if it is now fixed for you. Thanks.
ConsoleAppender now behaves as before (1.2.11) by default. I also tested with <param name="HonorReassignment" value="true"/> and it did behave as it does in 1.2.12. Looks good! Thanks for the quick fix!
Fix verified by reporter (thanks!). Closing.
*** Bug 37452 has been marked as a duplicate of this bug. ***