Why is Log4Net so slow in my windows service?

I have a windows service that uses log4net. We noticed that the service in question was slow, so we connected a debugger to it and took a step further. It seems that every time he tries to write a log entry through log4net, it takes 10 to 30 seconds before the next line of code can execute. Obviously this adds ...

Service 2.0.net We use log4Net 1.2.0.30714. We tested this on a machine running Vista and a machine running win 2003, and we saw the same or similar results.

+3
source share
6 answers

Jeff mentioned a performance issue with Log4Net in Podcast 20 . Perhaps you see a similar problem.

+1
source

It turned out that someone added SMPTAppender to the configuration file, which was overridden in our application. As a result, the wrong SMPT server address was unavailable. log4net tried to register an error for a minute per request, and then refused and moved on to the next line of code. Correcting the smtp address fixed the problem.

+1
source

log4net adonet appender Windows. appender ?

0

Log4Net. Log4Net , , .

0
source

Well, I do not disconnect ... this is written to the log file on the machine on which it works. Here are my appender settings:

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender,log4net">
      <file value="D:\\ROPLogFiles\\FileProcessor.txt" />
      <appendToFile value="true" />
      <datePattern value="yyyyMMdd" />
      <rollingStyle value="Date" />
      <layout type="log4net.Layout.PatternLayout,log4net">
        <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n" />
      </layout>
      <threshold value="INFO" />
    </appender>
0
source

the default maximum file size is 10 MB. if your files are this size and your file systems are quite full and probably heavily fragmented, maybe the problem is there. how large are your log files? I encountered similar problems with gigabyte log files.

0
source

Source: https://habr.com/ru/post/1699385/


All Articles