1:添加log4net.dll引用
2:建Log4Net.config
包含具体设置参数
3: Global.asax
protected void Application_Start(object sender, EventArgs e)
{
log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(Server.MapPath("~") + @"\Log4Net.config"));
}
4:代码使用实例
protected void Button1_Click(object sender, EventArgs e)
{
log4net.ILog Logger = log4net.LogManager.GetLogger(this.GetType());
Logger.Info("log test test log");
}