Logging best practices [closed]

I’d like to get stories on how people are handling tracing and logging in real applications. Here are some questions that might help to explain your answer.

Frameworks

What frameworks do you use?

  • log4net
  • System.Diagnostics.Trace
  • System.Diagnostics.TraceSource
  • Logging application block
  • Other?

If you use tracing, do you make use of Trace.Correlation.StartLogicalOperation?

Do you write this code manually, or do you use some form of aspect oriented programming to do it? Care to share a code snippet?

Do you provide any form of granularity over trace sources? E.g., WPF TraceSources allow you to configure them at various levels:

  • System.Windows – settings for all of WPF
  • System.Windows.Animation – override specifically for Animation.

Listeners

What log outputs do you use?

  • Text files
  • XML files
  • Event log
  • Other?

If using files, do you use rolling logs or just a single file? How do you make the logs available for people to consume?

Viewing

What tools to you use for viewing the logs?

  • Notepad
  • Tail
  • Event viewer
  • Systems Center Operations Manager/Microsoft Operations Manger
  • WCF Service Trace Viewer
  • Other?

If you are building an ASP.NET solution, do you also use ASP.NET Health Monitoring? Do you include trace output in the health monitor events? What about Trace.axd?

What about custom performance counters?

10 Answers
10

Leave a Comment