.net Diagnostics best practices?
        Posted  
        
            by mamu
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mamu
        
        
        
        Published on 2010-05-08T19:19:22Z
        Indexed on 
            2010/05/08
            19:28 UTC
        
        
        Read the original article
        Hit count: 339
        
.NET
|system.diagnostics
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?
© Stack Overflow or respective owner