1. 下載Log4Net
    http://logging.apache.org/log4net/download.html
  2. 解開,在專案中加入參考
  3. 設定好config.xml (範例可google一下)
  4. 加入
    using log4net;
    using log4net.Config
  5. 取得config.xml,類似以下範例
    XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("config.xml")));
  6. 宣告 (ClassName替換成使用中的Class)
    private static readonly ILog log = LogManager.GetLogger(typeof(ClassName));
  7. Done!

 

arrow
arrow
    全站熱搜

    give 發表在 痞客邦 留言(0) 人氣()