While trying to execute the following lines only the last two statements are displayed(\"Here is some ERROR\" and \"Here is some FATAL\") and the first three statements are
Here's a quick one-line hack that I occasionally use to temporarily turn on log4j debug logging in a JUnit test:
Logger.getRootLogger().setLevel(Level.DEBUG);
or if you want to avoid adding imports:
org.apache.log4j.Logger.getRootLogger().setLevel(
org.apache.log4j.Level.DEBUG);
Note: this hack doesn't work in log4j2 because setLevel has been removed from the API, and there doesn't appear to be equivalent functionality.