You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Kevin Hale Boyes <ke...@illuminatnm.com> on 2003/02/12 19:54:18 UTC

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: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: help with appender problem

Posted by Kevin Hale Boyes <ke...@illuminatnm.com>.
I just got back to this...
It seems that bug 13201 does indeed describe my problem.
Thanks for the info.
K.


Ceki Gülcü wrote:
> 
> This was discussed as late as yersterday.
> 
> See http://marc.theaimsgroup.com/?t=104497294500002&r=1&w=2
> 
> and in particular
> 
> http://marc.theaimsgroup.com/?l=log4j-user&m=104498017406236&w=2
> 
> At 14:54 12.02.2003 -0400, you wrote:
> 
>> 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: log4j-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>>
> 
> -- 
> Ceki
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: help with appender problem

Posted by Ceki Gülcü <ce...@qos.ch>.
This was discussed as late as yersterday.

See http://marc.theaimsgroup.com/?t=104497294500002&r=1&w=2

and in particular

http://marc.theaimsgroup.com/?l=log4j-user&m=104498017406236&w=2

At 14:54 12.02.2003 -0400, you wrote:
>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: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>

--
Ceki 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org