private static void writeExceptionLog(Exception ex)
{
try
{
string curPath = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
string filePath = curPath + "\\exceptionLog.log";
using (StreamWriter writer = new StreamWriter(filePath, true))
{
writer.WriteLine("Message :" + ex.Message + "<br/>" + Environment.NewLine + "StackTrace :" + ex.StackTrace +
"" + Environment.NewLine + "Date :" + DateTime.Now.ToString());
writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
}
}
catch (Exception)
{
}
}
'C#(CSharp) > Etc' 카테고리의 다른 글
IOException: The process cannot access the file 'file path' because it is being used by another process (0) | 2018.06.23 |
---|---|
C# memory cache logic (0) | 2018.05.31 |
c# memory cache (0) | 2018.05.26 |
Deleting multiple files with wildcard (0) | 2018.05.17 |
How to crop an image using C#? (0) | 2018.05.09 |