If you are writing server code in C# or to a lesser extent desktop/client then it's a good idea to include logging code so when something goes wrong you know where to start looking. The Java world has done the same for years and Apache log4j is a ver…
Apache log4net™ Config Examples Overview This document presents example configurations for the built-in appenders. These configurations are designed to work with the log4net.Config.DOMConfigurator and the log4net.Repository.Hierarchy.Hierarchy. These…
When logging with log4net to a file (using the FileAppender), the FileAppender is holding an exclusive write lock on the file. This doesn't cause any problems, not even when the application is running with multiple threads, because log4net should be…
我们在做开发的时候,需要把一些信息记录下来,方便问题排查.数据分析和统计.通常我们使用log4net作为logging的工具,但是大部分时候需要加以封装,以便更加方便的使用,并且不妨碍主业务程序的运行.下面就是一个异步logging的例子,关键在于: 简洁:不做过度封装,能满足需要的就是做好的,“done is better than perfect”: 异步:所有的信息都以异步的方式进行记录,不会对主业务逻辑造成任何的block. 首先,在一个新建的工程里引用log4net.dll,并且进行简…