public static string foldUrl = FM.Core.Utility.ConfigHelper.Instance.GetAppSetting("WriteLogFileUrl");
public static string fileUrl = DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
/// <summary>
/// 日志写入
/// </summary>
/// <param name="str"></param>
public static void WriteLog(string str)
{
//文件夹地址
if (!Directory.Exists(foldUrl))
Directory.CreateDirectory(foldUrl);
//文件地址
string strFileUrl = foldUrl + fileUrl;
System.IO.StreamWriter sw = null;
if (!System.IO.File.Exists(strFileUrl))
sw = System.IO.File.CreateText(strFileUrl);
else
sw = new System.IO.StreamWriter(strFileUrl, true);
sw.BaseStream.Seek(0, System.IO.SeekOrigin.End);
sw.WriteLine(str);
sw.Flush();
sw.Close();
}