1 Evaluation of Logging Frameworks
Elinus Persson edited this page 2026-05-12 11:39:33 +00:00

Evaluation of Logging Frameworks

Introduction

Larger and even medium projects (like this one) need logging to format timelines of events and provide general overviews of the system. But for the moment, this is done by a scattering random Console.WriteLine statemnts in the code. This does get the job done, but it is far from being even close to optimal. A selection where monitoring behaviours, diagnosing issues, and just general filtering of messages are possible is needed. A logging system would do all described and more.

Requirements

  • Log Levels: I most be possible to use the standard login levels (Information, Warning, Error, Debug, etc.) so that if an error happens, it can be caught as such by its login level.
  • Traceability: The logs should be easy to follow to the class and or service that created them.
  • Environment Compatibility: The logging system must work well with dotnet and Docker to be added to our stack.
  • Low Overhead: A giant solution isn't needed. It should be easy to use, with minimal setup and resource usage.

Options found

ILogger

ILogger is a high-performance, structured logging API to help monitor application behavior and diagnose issues. Its basic logging providers are already built-in to ASP.NET Core ILogger is better for debugging since it adds structure and control to logging Advantages over Console.WriteLine. ILogger can:

  • Structure logs
  • Support information, Warning, Error, Debug, etc.
  • Easy to filter
  • Logs can show which service/class created them
  • Consistent formatting
  • Designed for production apps
  • connect to files, databases, and dashboards.
Pros:
  • already included
  • easy to use
  • supports log levels
  • works well with Docker
  • Can integrate with other logging libraries later

Serilog

It is modern. Net logging library designed for structured logging and built with powerful structured event data.

Pros:
  • structured logs
  • beautiful console logs
  • file logging
  • excellent Docker support
Cons:
  • More setup
  • An extra dependency.

Conclusion

ILogger is a high-performance, structured logging API to help monitor application behavior and diagnose issues. Its basic logging providers are already built-in to ASP.NET Core The ILogger is going to be used