logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvrmc <dvrm.chowd...@aricent.com>
Subject Re: log4j : How to avoid duplicate logmessages in a multithreaded application?
Date Thu, 31 Jan 2008 05:30:12 GMT

Hi james,
Thanks for the reply. I m configuring log4j using a DOMConfigurator as shown
below. I m not sure what exactly the configure method does though.
               DOMConfigurator.configure(prop.getProperty("Log4jConfig"));
Also, the no. of duplicate logger messages I see is constant(around 8-9). I
have 8 appenders in the log4j-config.xml file  too. Are they adding up?

Regards.


James A. N. Stauffer wrote:
> 
> My guess is that log4j is being configured multiple times.  Each time
> log4j is configured, the new configuration is added to the current
> configuration.
> 
> How are you configuring log4j?
> 
> On Jan 30, 2008 3:00 AM, dvrmc <dvrm.chowdary@aricent.com> wrote:
>>
>> Hi,
>> I m using log4j for my heavily multithreaded JAVA application. After my
>> application comes up, a few minutes later , I find many duplicate logger
>> messages on the console(only logger messages in threads are being
>> displayed
>> 8-9 times each). Is it that my application being multithreaded or is
>> there
>> something wrong with my configuration file?
>>
>> My log4j-config.xml is as below:-
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
>>
>> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
>>                      configDebug="true">
>>
>>         <appender name="ASYNC" class="org.apache.log4j.AsyncAppender"
>> additivity="false">
>>                 <appender-ref ref="TEMP"/>
>>                 <appender-ref ref="CONSOLE"/>
>>                 <appender-ref ref="TRACE"/>
>>                 <appender-ref ref="DEBUG"/>
>>                 <appender-ref ref="INFO"/>
>>                 <appender-ref ref="WARN"/>
>>                 <appender-ref ref="ERROR"/>
>>                 <appender-ref ref="FATAL"/>
>>         </appender>
>>
>>         <appender name="CONSOLE"
>> class="org.apache.log4j.ConsoleAppender">
>>                 <!-- param name="ImmediateFlush" value="true"/-->
>>                 <layout class="org.apache.log4j.PatternLayout">
>>                      <!-- param name="ConversionPattern"
>>                             value="%d %-5p [%t] %C %A (%F:%L) - %m%n"/-->
>>                 </layout>
>>         </appender>
>>
>>
>>         <appender name="TEMP" class="org.apache.log4j.FileAppender">
>>
>>                 <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>         </appender>
>>
>>         <appender name="TRACE" class="org.apache.log4j.FileAppender">
>>
>>
>>         <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>         </appender>
>>
>>         <appender name="DEBUG" class="org.apache.log4j.FileAppender">
>>
>>
>>         <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>         </appender>
>>
>>         <appender name="INFO" class="org.apache.log4j.FileAppender">
>>
>>         <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>
>>                 <filter class="org.apache.log4j.varia.LevelMatchFilter">
>>
>>                 </filter>
>>
>>         <filter class="org.apache.log4j.varia.DenyAllFilter"/>
>>         </appender>
>>
>>         <appender name="WARN" class="org.apache.log4j.FileAppender">
>>
>>         <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>
>>                 <filter class="org.apache.log4j.varia.LevelMatchFilter">
>>
>>             </filter>
>>         <filter class="org.apache.log4j.varia.DenyAllFilter"/>
>>         </appender>
>>
>>         <appender name="ERROR" class="org.apache.log4j.FileAppender">
>>
>>         <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>
>>                 <filter class="org.apache.log4j.varia.LevelMatchFilter">
>>
>>             </filter>
>>         <filter class="org.apache.log4j.varia.DenyAllFilter"/>
>>         </appender>
>>
>>         <appender name="FATAL" class="org.apache.log4j.FileAppender">
>>
>>         <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>
>>                 <filter class="org.apache.log4j.varia.LevelMatchFilter">
>>
>>             </filter>
>>         <filter class="org.apache.log4j.varia.DenyAllFilter"/>
>>         </appender>
>>
>>         <appender name="SLCS" class="org.apache.log4j.FileAppender">
>>
>>                 <layout class="org.apache.log4j.PatternLayout">
>>
>>                 </layout>
>>         </appender>
>>
>>         <category name="com.aircell.abs.acpu.softwareloadconfig"
>> additivity="false">
>>       <level value="debug"/>
>>         <appender-ref ref="SLCS"/>
>>       </category>
>>
>>         <root>
>>                 <priority value="info"/>
>>                 <appender-ref ref="ASYNC"/>
>>         </root>
>> </log4j:configuration>
>>
>>
>>
>> Regards.
>> --
>> View this message in context:
>> http://www.nabble.com/log4j-%3A-How-to-avoid-duplicate-logmessages-in-a-multithreaded-application--tp15177220p15177220.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
> 
> 
> 
> -- 
> James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/log4j-%3A-How-to-avoid-duplicate-logmessages-in-a-multithreaded-application--tp15177220p15198434.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Mime
View raw message