Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-533

Log4Net version 1.2.15.0 uses much more CPU than 1.2.11.0

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: 1.2.15
    • Component/s: Core
    • Labels:
      None
    • Flags:
      Patch, Important

      Description

      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.

        Attachments

        1. Release_1_2_15.zip
          759 kB
          Ronald Putz

          Issue Links

            Activity

              People

              • Assignee:
                nachbarslumpi Dominik Psenner
                Reporter:
                RonnyPutz Ronald Putz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: