close
//紀錄Log方法

private void Log(string msg)
{
    System.IO.File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + @"\log.txt", DateTime.Now + "\t" + msg + Environment.NewLine);
}

//.net 2.0 Log記錄寫法

string path = AppDomain.CurrentDomain.BaseDirectory + @"\log.txt";
using (StreamWriter sw = File.AppendText(path)) 
{                    
    sw.WriteLine(DateTime.Now.ToString() + "  " + ex.ToString());
}

 

arrow
arrow
    文章標籤
    C#
    全站熱搜

    芭樂養樂多 發表在 痞客邦 留言(0) 人氣()