最近在使用log4net,在使用之前我们必须知道文件流是如何操作的,否则就是盲人摸向。。。,在FileAppender.cs文件里面有LockingModelBase来控制流的锁,默认有3个子类
ExclusiveLock:默认的,Hold an exclusive lock on the output file,Open the file once for writing and hold it open until CloseFile is called. Maintains an exclusive lock on the file during this time.
MinimalLock:Acquires the file lock for each write,Opens the file once for each AcquireLock / ReleaseLock cycle, thus holding the lock for the minimal amount of time.This method of locking is considerably slower than FileAppender.ExclusiveLock but allows other processes to move/delete the log file whilst logging continues.
InterProcessLock:Provides cross-process file locking.使用Mutex来实现多进程
这里意思是MinimalLock比ExclusiveLock慢一点,因为它每次都会打开关闭文件流。
不过有2个类感觉比较重要PatternString.cs
登录后复制
以上就是log4Net 高性能写入和CSV格式的实例详解的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2443526.html