public void Log(string message) { try { string logFileName = "c:\\log\\LogName" + DateTime.Now.ToString("yyyy-MM-dd") + ".log"; using (TextWriter logFile = TextWriter.Synchronized(File.AppendText(logFileName))) { logFile.WriteLine("\r\n"); logFile.WriteLine(DateTime.Now); logFile.WriteLine(message); logFile.Flush(); logFile.Close(); } } catch(Exception ex) { throw new InvalidPluginExecutionException("Log Create Error:" + ex.Message.ToString()); } }
controller
public void Log(string message) { try { string logFileName = "E:\\LogName" + DateTime.Now.ToString("yyyy-MM-dd") + ".log"; using (TextWriter logFile = TextWriter.Synchronized(File.AppendText(logFileName))) { logFile.WriteLine("\r\n"); logFile.WriteLine(DateTime.Now); logFile.WriteLine(message); logFile.Flush(); logFile.Close(); } } catch (System.Exception ex) { throw ex; } }