public static void setlog(string contents)
{
string txtPath = ConfigurationManager.AppSettings["TxtFile"];//获取配置文件的文件存放地址
string filePath = txtPath + "/" + DateTime.Now.ToString("yyyyMMdd");
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string[] files = Directory.GetFiles(filePath);
string fileAllName = filePath+"/"+DateTime.Now.Date.ToString("yyyyMMdd") + ".txt";
File.WriteAllText(fileAllName, contents);
}
{
string txtPath = ConfigurationManager.AppSettings["TxtFile"];//获取配置文件的文件存放地址
string filePath = txtPath + "/" + DateTime.Now.ToString("yyyyMMdd");
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string[] files = Directory.GetFiles(filePath);
string fileAllName = filePath+"/"+DateTime.Now.Date.ToString("yyyyMMdd") + ".txt";
File.WriteAllText(fileAllName, contents);
}