好久没有更新blog了,真是有点惭愧。最近项目比较忙,不巧的是今天又发现我的log4net无法正常工作了,通过网上的搜索和反复的测试,终于发现了问题,同时也学到了几个新的技巧,拿出来眩一眩。
还是说一下出的问题吧。
问题描述:log4net不记录任何的错误。
问题解决:由于在配置文件中
再来说一下我刚学到的技巧
1、Log4net的RollingFileAppender按照日期生成同一后缀名的文件
这样可以生成Log-yyyy-MM-dd.htm的文件,怎么样不错吧,在这里要感谢9527的晃悠人生的用log4net快速构建asp.net 异常日志
注:在阅读log4net帮助文档的时候发现了一段黑体标注的话,摘录下来
A simple call to LogManager.GetLogger will cause the attributes on the calling assembly to be read and processed. Therefore it is imperative to make a logging call as early as possible during the application start-up, and certainly before any external assemblies have been loaded and invoked.
我个人理解,在做asp.net程序的时候,就是在global.asax里面就声明:
不知道这样理解对不对。