My log4j.properties file is pasted below. My understanding is that we need to add Appenders to the *root *logger for the appender to work. As you can see in the below properties file, only appender A is attached to the root logger (log4j.rootLogger=info, A). However, what I see is that the logging information is printed to both the appenders (ConsoleAppender - A and File Appender - B). How is this possible?
log4j.rootLogger=info, A log4j.appender.A=org.apache.log4j.ConsoleAppender log4j.appender.A.layout=org.apache.log4j.PatternLayout log4j.appender.A.layout.ConversionPattern=%-4r [%t] [rid=%X{RID} ] %-5p %c %x - %m%n log4j.appender.B=org.apache.log4j.FileAppender log4j.appender.B.layout=org.apache.log4j.PatternLayout log4j.appender.B.file=target/server.log log4j.appender.B.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n I have posted the same question on stackoverflow-link <http://stackoverflow.com/questions/24679226/all-log4j-appenders-defined-in-log4j-properties-in-play> and failed to get any responses. Any resposes appreciated. Regards, Vishal Pore