1.下载log4net并解压,E:/tools/log4net-1.2.10/bin/net/2.0/debug/下找到log4net.dll,将其引入
2.配置Web.Config
3.Log操作类
4.加入Global.asax如下:
5. 使用:
try
{
int a = 1, b = 9, c = 0;
a = b / c;
}
catch (Exception ex)
{
LogHelper.WriteLog("errerinfo输出一行异常信息", ex);
}