.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

trace listener

Posted By:Jegan R       Posted Date: November 03, 2010    Points: 15    Category: SharePoint    URL: http://www.dotnetspark.com  

You can set the trace listener as set in the following
 

class Program
{
public class Sample
{

public static int Main(string[] args)
{
Stream myFile = File.Create("c:\\test.txt");

TextWriterTraceListener myTextListener = new
TextWriterTraceListener(myFile);
Trace.Listeners.Add(myTextListener);
Debug.Listeners.Add(myTextListener);

Trace.Write("Test trace output ");
Debug.Write("Test debug output ");


Trace.Flush();

return 0;
}
}
}



     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend