Logging exceptions to Fileshare using C#.NET. Sample code.
try
{
string filePath = @"\\sharepointFix\Error.txt";
.............
.............
}
catch
{
using (StreamWriter writer = new StreamWriter(filePath, true))
{
writer.WriteLine("Message: " + exp.Message + Environment.NewLine + "Stack Trace : " + exp.StackTrace
+ Environment.NewLine + "Inner Exception: " + exp.InnerException
+ Environment.NewLine + "Date :" + DateTime.Now.ToString());
}
}
try
{
string filePath = @"\\sharepointFix\Error.txt";
.............
.............
}
catch
{
using (StreamWriter writer = new StreamWriter(filePath, true))
{
writer.WriteLine("Message: " + exp.Message + Environment.NewLine + "Stack Trace : " + exp.StackTrace
+ Environment.NewLine + "Inner Exception: " + exp.InnerException
+ Environment.NewLine + "Date :" + DateTime.Now.ToString());
}
}