set additivity=false -----Original Message----- From: Kevin Hale Boyes [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 12, 2003 10:54 AM To: [EMAIL PROTECTED] Subject: help with appender problem
I've just started using Log4J in my Struts-based web application. The application directly uses commons-logging but it is configured to use Log4J. I'm having a problem in that messages are logged twice. I suspect it has to do with the way I've configured my appenders (because of the line in the user manual that says "In other words, appenders are inherited additively from the logger hierarchy.") but I can't see what the problem is. Here is my log4j.properties file: ------------------------------------ log4j.rootLogger=DEBUG log4j.debug=true log4j.logger.com.illuminat.cml=DEBUG, rolling log4j.logger.org.apache=WARN, stdout log4j.logger.org.apache.struts=DEBUG log4j.logger.org.apache.struts.util.PropertyMessageResources=WARN log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n log4j.appender.rolling=org.apache.log4j.DailyRollingFileAppender log4j.appender.rolling.File=rolling-output.log log4j.appender.rolling.layout=org.apache.log4j.PatternLayout log4j.appender.rolling.layout.ConversionPattern=%d - %p %c - %m%n ------------------------------------ The intention is to not have an appender on the rootLogger but only on the child loggers. So I want messages for the "com.illuminat.cml" logger to go only to the rolling appender and messages for the "org.apache" logger to go only to the console. Can anyone see why I'm getting messages from the "org.apache" logger printed twice as shown in the following output: ------------------------------------ DEBUG [main] (ActionServlet.java:1396) - Mapping for servlet 'action' = '*.do' 1074 [main] DEBUG action.ActionServlet - Mapping for servlet 'action' = '*.do' DEBUG [main] (ActionServlet.java:902) - Initializing module path '' configuration from '/WEB-INF/struts-config.xml' 1078 [main] DEBUG action.ActionServlet - Initializing module path '' configuration from '/WEB-INF/struts-config.xml' ------------------------------------ The first line of the message output corresponds to the log4j.appender.stdout.layout.ConversionPattern defined above but the second line doesn't seem to correspond to any pattern I've defined. Thanks for any help, Kevin. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]