I have a setup that involves Tomcat 7 running under JDK6 which has been using lgo4j 2 since around beta3 or so. After a recent upgrade attempt I was left with a system that basically had no logging at all.
I started back at beta6 (my last known working version) and upgraded one release at a time until it finally broke at beta9. I got the source code for this version and spent a considerable amount of time running Tomcat under a debugger and tracing it down to an exception that occurs during initialization of the XML config.
The actual exception, however, is not caught and then subsequently lost higher up in the stack! And, to make matters worse, it never gets to the point of creating the StatusLogger, so I can't get any help from that kind of trace output. So as a result, it just silently fails, and reverts back to the default configuration of ERROR to Console only with no internal log messages.
After narrowing down to where the exception occurs, it seems to have been introduced in beta9 by
LOG4J2-341 which adds XInclude support. The offending line is in XMLconfiguration.enableXInclude(...) where it calls factory.setXIncludeAware(true). I was unable to get the actual exception itself, but I think it was a NoSuchMethodError. Using debug watches I painstakingly constructed this stack trace (line #s are based on beta9 code):
This call is wrapped in a try/catch, but only catches these exceptions:
I compared each version after that, and the code for this method hasn't really changed much (some revisions in 2.0-rc2 I believe) so that would be why the issue persists in 2.1 still.
I have a feeling the javax.xml.* libraries on my system are outdated, and will look into that further. But in the meantime I figured I would report this not-graceful-at-all handling of the situation where XInclude is not supported by the system. Hopefully this is enough detail for someone to be able to reproduce & fix the problem.