public static void FinalizeData() { if (autoRollBackTransThread != null) { autoRollBackTransThread.Abort(); } if (DataLogFileWriter != null) { DataLogFileWriter.Close(); } if (ErrorLogFileWriter != null) { ErrorLogFileWriter.Close(); } }
public static void WriteToLog(string e) { DateTime timeEnd = DateTime.Now; DateTime timeBegin = DateTime.Now; StringBuilder logStr = new System.Text.StringBuilder(); logStr.Append("\r\n--->St:").Append(timeEnd.ToString("yyyy-MM-dd HH:mm:ss.fff")).Append(" Response error, ").Append(timeEnd.Subtract(timeBegin).Milliseconds).Append(" ms:"); logStr.Append("\r\n").Append(e); logStr.Append("\r\n--->Ed:").Append(e); DailyLogFileWriter DataLogFileWriter = null; string logPath = ConfigurationManager.AppSettings["WeChatLogPath"]; DataLogFileWriter = new DailyLogFileWriter(logPath, "LOG"); DataLogFileWriter.Write(timeBegin.ToString("yyyy-MM-dd"), logStr.ToString()); DataLogFileWriter.Close(); }