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
This is happening due to the fact that the logging level of your logger is set to 'error' - therefore you will only see error messages or above this level in terms of severity so this is why you also see the 'fatal' message.
If you set the logging level to 'debug' on your logger in your log4j.xml you should see all messages.
Have a look at the log4j introduction for explaination.
Put a file named log4j.xml
into your classpath. Contents are e.g.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %t %c{1}:%L - %m%n"/>
</layout>
</appender>
<root>
<level value="debug"/>
<appender-ref ref="stdout"/>
</root>
</log4j:configuration>