I am just starting with log4j. I don\'t have a problem with it reading my properties file and actually logging events, but it seems to be appending everything to the end of
Are those %m%n
on the same line as the rest? If not, that would explain it.
Oh, and for the 2nd appender, you have a % after %n
. That doesn't look right either.
Replace
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x -
%m%n
with
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
Same for A2 + there remove the %
after the n %m%n%
-> m%n
Basically you seem to have a newline after the -
character in your ConversionPattern
lines. That would explain why the newline isn't output (%n
--> outputs platform dependend newline character)
Btw. if you want to know what the options mean
javadoc: PatternLayout