I have the following log4j configuration:
<appender name="MYCONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="INFO"/>
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}|%-5p|MYAPP|%t|%C{1}.%M(%L)|%m%n"/>
</layout>
</appender>
<appender name="MYFILE" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${jboss.server.log.dir}/myapp.log"/>
<param name="Append" value="true"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}|%-5p|MYAPP|%t|%C{1}.%M(%L)|%m%n"/>
</layout>
</appender>
In the Eclipse console, every log line produced by this configuration is followed by a completely blank line:
12:46:27,289 INFO [stdout] 2017-01-25 12:46:27,289|INFO|MYAPP|something
12:46:27,289 INFO [stdout] 2017-01-25 12:46:27,289|INFO|MYAPP|something else
This happens only with logs generated by MYCONSOLE, all other logs (such as the internal JBoss's ones) don't have blank lines. Also, in the MYFILE log file, the logs are the same but the blank lines are not there.
What could be the reason?
I was able to get rid of the extra lines by using \n instead of %n.
The reason of the strange behaviour of %n is still not clear to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With