First, your understanding is incorrect. You can attach appenders to any logger, not just the root. Second, there must be some other stray log4j config file being loaded, instead of this one, that logs to a file appender pointing at the same file as the one in this log4j.properties.
I suggest you start up the server with the following system property set to be able to see how log4j is loading configuration...
-Dlog4j.debug=true Jake On Fri, 11 Jul 2014 11:31:22 +0530 Vishal Pore <pore.vis...@gmail.com> wrote:
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
--------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org