Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
1.2.15
-
None
-
None
-
4.5.2 .NET Framework
Description
1.2.15 RollingFileAppender is 60% slower than 1.2.11. I am using the following code and app.config file to test the 2 versions.
APP.CONFIG
========================
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingFileAppender" />
</root>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender, log4net">
<file value="C:\TraceLogging\TraceLoggingTeset1.2.15.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="20MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout, log4net">
<param name="ConversionPattern" value="%date [%thread] %-5level [%logger].%message%newline" />
</layout>
</appender>
</log4net>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
========================
CODE:
========================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using log4net.Core;
namespace TraceLoggingTest
{
public partial class Form1 : Form
{
public log4net.ILog Logger;
public Form1()
{ InitializeComponent(); Logger = log4net.LogManager.GetLogger("Form1"); log4net.Config.XmlConfigurator.Configure(); } private void btnTest_Click(object sender, EventArgs e)
{
Logger.Debug("=====================================================");
Stopwatch sw = new Stopwatch();
sw.Start();
for (int i = 0; i < 5000; i++)
sw.Stop();
Logger.Debug("TOTAL TIME [" + sw.ElapsedMilliseconds.ToString() + "]");
this.lblTime.Text = sw.ElapsedMilliseconds.ToString() + " ms";
Logger.Debug("=====================================================");
}
}
}
========================
Attachments
Issue Links
- duplicates
-
LOG4NET-487 Control mutex type
- Open