/// /// The main entry point for the application. ///
[STAThread]
public static void Main()
{
try {
// setup generic exception handler...
SWF.Application.ThreadException += new ST.ThreadExceptionEventHandler(App.OnAppException);
// setup cleanup routine for normal app shutdown...
SWF.Application.ThreadExit += new System.EventHandler(App.OnAppExit);
// when app starts, delete the previous log file (if any) string logfile = System.AppDomain.CurrentDomain.BaseDirectory + "AppLog.txt"; System.IO.TextWriter log = new System.IO.StreamWriter(logfile);
if (Globals.Trace) // then also send trace output to log file? {
System.Diagnostics.TextWriterTraceListener logger; logger = new System.Diagnostics.TextWriterTraceListener(log); System.Diagnostics.Trace.Listeners.Add(logger);
System.Diagnostics.Trace.Write("App starting: " + DateTime.Now); } SWF.Application.Run(new Form1()); }
catch(Exception ex)
{ OnAppException(null, new ST.ThreadExceptionEventArgs(ex)); }
以上是利用Trace类来记录程序运行日志的代码,可每次当应用程序重启后,AppLog.txt文件里以前的内容就被覆盖了。谁知道这个问题怎么解决呢?
目前暂无任何回答
- 0 回答
- 0 关注
- 706 浏览
添加回答
举报
0/150
提交
取消