.net Diagnostics best practices?
- by mamu
We initially didn't use any logging or debug tracing but after spending few weeks to trace down some data corruption we decided to put required Debug.Write and Trace for production and Debug.Assert
So now question is What is the best practice to use debug and trace logging. I am just looking for some thing generic.
public void AddRectodatabase(object record)
{
Debug.WriteLine(record.ToString());
Trace.WriteLine(record.ToString());
// Add it to databse
Debug.Assert(true, "Use this on case by case basis");
}
Is this good enough for general purpose, am i doing anything wrong in there?
We want to stick with .net System.Diagnostics over other alternatives like log4net.
Is there any thing else useful in System.Diagnostics?