Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage
This commit is contained in:
commit
192d8c7841
2 files changed
+46
-31
No files matched your search
+30
-20
@@ -38,10 +38,6 @@ namespace formula_manage
|
|||||||
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
|
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
|
||||||
}
|
}
|
||||||
|
|
||||||
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
|
||||||
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
|
||||||
//string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
|
||||||
|
|
||||||
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
@@ -65,28 +61,42 @@ namespace formula_manage
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
string Log_time = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
|
string logpath = System.Environment.CurrentDirectory + "\\ERR";//日志文件目录
|
||||||
|
//string logPathtxt = "" + System.Environment.CurrentDirectory + "\\Log\\"+ Log_time + "Log.txt";//日志文件
|
||||||
|
// System.IO.DirectoryInfo log = new System.IO.DirectoryInfo();//生成日志文件目录
|
||||||
string log_path = logpath + "\\ERR" + Log_time + ".txt";
|
string log_path = logpath + "\\ERR" + Log_time + ".txt";
|
||||||
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
string Log_timehms = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
if (!File.Exists(log_path))//检查文件并写入
|
if (Directory.Exists(logpath))//检查日志路径
|
||||||
{
|
{
|
||||||
FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
if (!File.Exists(log_path))//检查文件并写入
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
{
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
FileStream fs = new FileStream(log_path, FileMode.CreateNew, FileAccess.Write);//创建文件
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
wr.Close();
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
FileStream fil = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||||
wr.Close();
|
StreamWriter wfil = new StreamWriter(fil);//创建文件
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||||
|
wfil.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
||||||
|
wfil.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
||||||
|
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileStream fs = new FileStream(log_path, FileMode.Append, FileAccess.Write);//创建写入文件
|
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
directoryInfo.Create();
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error] ||" + Environment.NewLine.ToString());
|
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error source] ||" + e.Exception.Source.ToString() + Environment.NewLine.ToString());
|
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error message] ||" + e.Exception.Message.ToString() + Environment.NewLine.ToString());
|
|
||||||
wr.WriteLine("[" + Log_timehms + "];[Error area] ||" + e.Exception.StackTrace.ToString());
|
|
||||||
wr.Close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-11
@@ -11,22 +11,27 @@ namespace formula_manage.UserClass
|
|||||||
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件
|
string logPath = "" + System.Environment.CurrentDirectory + "\\Log\\" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";//日志文件
|
||||||
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
string Log_time = "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:";
|
||||||
|
|
||||||
System.IO.DirectoryInfo log = new System.IO.DirectoryInfo(@logpath);//生成日志文件目录
|
if (Directory.Exists(logpath))//检查日志路径
|
||||||
if (!File.Exists(logPath))//检查日志文件并写入启动日志
|
|
||||||
{
|
{
|
||||||
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
if (!File.Exists(logPath))//检查日志文件并写入启动日志
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
{
|
||||||
wr.WriteLine(Log_time + dat);
|
FileStream fs = new FileStream(logPath, FileMode.CreateNew, FileAccess.Write);//创建写入文件
|
||||||
wr.Close();
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + dat);
|
||||||
|
wr.Close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
||||||
|
StreamWriter wr = new StreamWriter(fs);//创建文件
|
||||||
|
wr.WriteLine(Log_time + dat);
|
||||||
|
wr.Close(); }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
|
DirectoryInfo directoryInfo = new DirectoryInfo(logpath);
|
||||||
StreamWriter wr = new StreamWriter(fs);//创建文件
|
directoryInfo.Create();//创建日志路径
|
||||||
wr.WriteLine(Log_time + dat);
|
|
||||||
wr.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user