天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
866 B

using System;
using System.Configuration;
using System.Globalization;
using System.IO;
namespace AutoFileCopyNet
{
public static class LogFileAccess
{
public static void WriteLogFile(string logMessage)
{
string logfilepath = GetConfigurationSettings.LOGFILEPATH;
if (!Directory.Exists(logfilepath))
{
Directory.CreateDirectory(logfilepath);
}
logfilepath = logfilepath + DateTime.Now.ToString("yyyyMMdd", DateTimeFormatInfo.InvariantInfo) + "log.txt";
StreamWriter sw = new StreamWriter(@logfilepath, true);
//sw.WriteLine("写日志:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
sw.WriteLine(logMessage);
sw.Flush();
sw.Close();
}
}
}