Logging System vs System.Diagnostics Tracing

As I now configure logging in my (Asp.Net Web Api) application, I read about best practices for logging. I came to this issue of logging best practices .

I sent the path Ninject Logging Extensions Nlog / Log4Net , but this question (or should I say the answer) made me think a second time.

At the moment I have tracing enabled, register every time here and there, and it feels a little dirty to have logs and traces that do not stack together.

I think that when I switch to Diagnostics Tracing and build on top of what the infrastructure already gives me, I will get a more complete trace. A track that tells the full story is more useful to me than a separate track and magazine, which both know about part of the story. And, of course, I could always separate things from listeners and filters.

But, on the other hand, I always found out:

Login! = Trace

So, this leaves me with the question, should I abandon the registration framework, is this the initial phase of the project, or should I stick to it?

And if I omit the registration framework, should I use the interface if we ever want to switch back to another logging / tracing structure again, or can I just depend on System.Diagnostics?

+4
source share
1 answer

I tried the Log4NET path and looked at Ninject.

From what I found, I would say that converting Diagnotisics.Trace to a logging structure is much more productive than trying to handle the weight of any of the logging frameworks I found. (And I agree that Trace! = Logging)

Perhaps I am a control freak, but I do not want a ton of opinions to get into my code base. I need tools, not a straitjacket.

There is little work to create Trace for the registration framework, but it is used many times, because this is just the main diagnostic dll that you probably already have in your program, if nothing else than StopWatch for synchronization.

In any case, only my opinion, but I prefer the Diagnostics.Trace route. Take a look at: http://www.codeproject.com/Articles/2680/Writing-custom-NET-trace-listeners - it's old, but it will show you what it takes to roll on its own.

+7
source

All Articles