1、引用Dll
版本是:1.2.10.0,
2、Web.config文件配置
3、Global.asax中Application_Start设置
//注册log4net(读取Log4Net配置信息)log4net.Config.XmlConfigurator.Configure();
4、调用
public class HomeController : BaseController{ private log4net.ILog logger = log4net.LogManager.GetLogger(typeof(HomeController)); ////// 网站主页 /// ///public ActionResult Index() { //日志 logger.Error("测试错误!" ); return View(); }}