logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-533) Log4Net version 1.2.15.0 uses much more CPU than 1.2.11.0
Date Wed, 23 Nov 2016 14:24:58 GMT

    [ https://issues.apache.org/jira/browse/LOG4NET-533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15690230#comment-15690230
] 

Dominik Psenner commented on LOG4NET-533:
-----------------------------------------

Thanks, I have run your sample applications with my performance profiler. At first glance
log4net 1.2.15 consumes more cpu cycles when rendering log events, yielding a speedup of 0.45.
That means that 1.2.11 was able to render about 2.2 times as many log events as 1.2.15 is
able to in the same amount of time. Looking at the call tree there is a significant change
to be observed. With 1.2.11 the MethodLocationPatternConverter used to consume the most cpu
cycles whereas 1.2.15 shows the PropertyPatternConverter as top cpu consumer. The PropertyPatternConsumer
itself spends most of the time with LoggingEvent.CreateCompositeProperties() which in turn
looks up the UserName by calling WindowsIdentity.get_Name(). With this information I was able
to bisect it to svn revision 1511303 which is linked to LOG4NET-205, which again is linked
as a breaker for LOG4NET-429.

This all boils down to the fact that this issue is a duplicate of LOG4NET-429.

As a workaround, you could remove property{context} from the patternlayout.

> Log4Net version 1.2.15.0 uses much more CPU than 1.2.11.0
> ---------------------------------------------------------
>
>                 Key: LOG4NET-533
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-533
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.15
>            Reporter: Ronald Putz
>            Priority: Blocker
>             Fix For: 1.2 Maintenance Release
>
>         Attachments: Release_1_2_15.zip
>
>
> We switched to the version 1.2.15 in our production system and figured out a general
increase. After a long analysis we have figured out that log4net uses more cpu compared to
the version 1.2.11.0
> config:
>  <configSections>
>     <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,
log4net" />
>   </configSections>  
>     <log4net debug="true">
>     <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
>       <layout type="log4net.Layout.PatternLayout">
>         <param name="ConversionPattern" value="%utcdate{yyyy-MM-dd HH:mm:ss.fff}	[%6thread]
[%36property{context}]	%-5level	%-35.35logger	%-25method	%message%newline" />
>       </layout>
>     </appender>
>     <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
>       <file value="c:\mylogfile.txt"/>
>       <appendToFile value="true"/>
>       <rollingStyle value="Size"/>
>       <maxSizeRollBackups value="5"/>
>       <maximumFileSize value="10MB"/>
>       <staticLogFileName value="true"/>
>       <!--filter type="log4net.Filter.StringMatchFilter">
>         <stringToMatch value="test"/>
>       </filter>
>       <filter type="log4net.Filter.StringMatchFilter">
>         <stringToMatch value="error"/>
>       </filter>
>       <filter type="log4net.Filter.DenyAllFilter"/!-->
>       <!--filter type="log4net.Filter.LevelRangeFilter">
>         <levelMin value="INFO"/>
>         <levelMax value="FATAL"/>
>       </filter!-->
>       <layout type="log4net.Layout.PatternLayout">
>         <param name="ConversionPattern" value="%utcdate{yyyy-MM-dd HH:mm:ss.fff}	[%6thread]
[%36property{context}]	%-5level	%-35.35logger	%-25method	%message%newline" />
>         <!--conversionPattern value="%date PID-%property{pid} TID-%thread %level -
%message%newline%exception %location %logger"/!-->
>       </layout>
>     </appender>
>       
>     <root>
>       <level value="DEBUG"/>
>       <appender-ref ref="RollingFileAppender"/>
>       <appender-ref ref="ConsoleAppender"/>
>     </root>
>   </log4net>
> C# code:
> 		static void Main(string[] args)
> 		{
> 			log4net.Config.XmlConfigurator.Configure();
> 			for (int i = 0; i < 10; i++)
> 			{
> 				Thread worker = new Thread(() =>
> 					{
> 						while (true)
> 						{
> 							Log.Debug(" This is the debug message!");
> 							Log.Error(" This is the error message!");
> 							Log.Info(" This is the info message!");
> 							Log.Fatal(" This is the fatal message!");
> 							Log.Warn(" This is the warning message!");
> 							Thread.Sleep(1000);
> 						}
> 					});
> 				worker.IsBackground = true;
> 				worker.Start();
> 			}
> 			for (int i = 0; i < 60; i++)
> 			{
> 				Thread.Sleep(1000);
> 			}
> 			return;
> We had to return to the old version of the log4net dll.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message