Click here to Skip to main content
15,072,776 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
A few months ago, I was introduced to Seq + Serilog in a Web service + Azure project that I did not lead. So I had a bit hand-on experience in these new toys, however, I was very puzzled, even though the team lead was very eager to teach me the new concept . I had grown up in the .NET world since 2003 with the concepts:

1. Use Trace and Debug of System.Diagnostics; and in complex applications and libraries, use TraceSource.
2 .NET codes have no knowledge of the logging mechanism. The logging is done through trace listeners, and trace listeners generally are injected by .NET runtime reading settings in element system.diagnostics in app.config, so some startup errors could be logged before the first line of the application code is running.
3. System.Diagnostics since .NET Framework 2 had already provided advanced tracing of structured data and correlation.

With Serilog, apparently you have to create an instance of LoggerConfiguration in your application codes and library codes, because .NET startup logic has no knowledge of it,
1. So startup errors won't be picked up by Serilog.
2. And every libraries you create will need to reference to Serilog just for the sack of logging. Why should I always reference to Serilog in every libraries? And not only 3rd party libraries, but WCF, WPF and WF etc. provides rich trace sources for diagnostics. Serilog is missing these. A workaround is to use Serilog Tracelistener. But a logging instrument on top of another instrument is looking odd to me.

The authors and lovers of Serilog had often compared Serilog with Log4Net and System.Diagnostics.Trace, however, I suppose that since .NET 2, System.Diagnostics had already surpassed Log4Net through TraceSource and other instructments.

Do you find some strong reasons why you are more in favor of Serilog over System.Diagnostics?

What I have tried:

I have read the materials about Serilog and Seq in more details in addition to those in the official Websites:

Tagging log events for effective correlation
Serilog at the beginning
IdentityServer 3 Logging & Monitoring using Serilog and Seq
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900