Implementing Log file using Enterprise Library in asp.net

前端 未结 3 859
被撕碎了的回忆
被撕碎了的回忆 2020-12-16 08:37

I m using Microsoft Enterprise Library 3.1 for Exception Handling in asp.net, the erors are stored in Event Viewer of the system .

Instead of Event

3条回答
  •  猫巷女王i
    2020-12-16 09:09

    Dear 2:30, You paste the following code inside configuration section at app.config or web.config file

      
        

    Application log can be logged into applog.log file using following statement

    Logger.Write("Application Started", "AppLog");
    

    Application exception can be logged into Exception.log file using following statement

    Logger.Write("Error: Invalid information you passed", "ExceptionHandling");
    

    Note: You can find the Logger class in Microsoft.Practices.EnterpriseLibrary.Logging;

    AppLog.log and Exception.log file will be created in bin folder automatically.

提交回复
热议问题