C# – Why does Log4Net run so slow in the Windows Service

.net-2.0c#-2.0log4netperformanceservice

I have a windows service that uses log4net. We noticed that the service in question was running painfully slow so we attached a debugger to it and stepped through. It appears that each time it tries to write an entry to the log via log4net that it takes anywhere from 10 to 30 seconds before the next line of code can execute. Obviously this adds up…

The service is 2.0 .net
We're using log4Net 1.2.0.30714.
We've tested this on a machine running vista and a machine running win sever 2003 and have seen the same or similar results.

Best Answer

Jeff mentioned a performance problem with Log4Net in Podcast 20. It's possible that you are seeing a similar issue.