Thursday, January 30, 2014

.NET low latency logging. Part 3 - log4net performance

Add log4net to the sample application

It is also very simple to integrate log4net into the sample application. Just add log4net package (current version is 1.2.13) with a NuGet to the project.

Add <log4net> section to the App.config file

Create a logger in code.


Note that log4net doesn't have Null appender out from the box. But it is not difficult to create it by inheriting from AppenderSkeleton with an empty void Append(LoggingEvent loggingEvent) override method:

Performance hints

My experiments showed the following key options that influence on log4net performance out of the box:
  • NullAppender that was implemented above is the fastest appender. It shows the general performance of logging internals and can be used to compare log4net with other similar components (e.g. NLog).
  • FileAppender is used to store logging messages to the specified file, but performs much slower than NullAppender
  • RollingFileAppender is usefull to separate logging messages by date, time or file size attribute, but performs a little bit slower than FileAppender

Performance of the NullAppender

Performance of the FileAppender and RollingFileAppender



  1. I like the way on how you put up your blogs. Wonderful and awesome. Hope to read more post from you in the future. Goodluck. Happy blogging!


  2. The mind is a great philosopher. And life is not a philosophy, life is a reality. And philosophy is an escape from reality; philosophy means thinking. Life is, there is no question of thought. You can simply jump into it. You can simply experience it. Visit my site for more information.Thank you.

  3. I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.