我如何创建一个log4net的包装asyncronous? [英] How do I create an asyncronous wrapper for log4net?

查看:138
本文介绍了我如何创建一个log4net的包装asyncronous?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在默认情况下,log4net的是一个同步日志机制,我想知道是否有办法有log4net的?


解决方案

如果你去log4net的网站上,你可以找到一些例子,其中至少有一个是异步的Appender



http://logging.apache.org/log4net/release/example-apps.html



请注意,我没有使用任何的这些例子,所以我不能为他们提供担保的一种方式或其他。



下面是一个链接从log4net的例子区域的实际异步的appender在他们的代码库:



http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/2.0 /Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs?view=markup



我看着它简单地说,它显然是作为一个包装一个或多个围绕传统的附加目的地。在每个记录请求(包含一个或多个LoggingEvent所对象),一个线程池线程用于转发LoggingEvents到包裹的Appender列表


By default, log4net is a synchronous logging mechanism, and I was wondering if there was a way to have asynchronous logging with log4net?

解决方案

If you go to the log4net website, you can find some examples, at least one of which is an asynchronous Appender.

http://logging.apache.org/log4net/release/example-apps.html

Note that I have not used any of these examples, so I cannot vouch for them one way or the other.

Here is a link to the actual asynchronous appender from the log4net Examples area in their code repository:

http://svn.apache.org/viewvc/logging/log4net/trunk/examples/net/2.0/Appenders/SampleAppendersApp/cs/src/Appender/AsyncAppender.cs?view=markup

I looked at it briefly, and it apparently acts as a wrapper around one or more "conventional" Appenders. On each logging request (containing one or more LoggingEvent objects), a ThreadPool thread is used to forward the LoggingEvents to the list of wrapped Appenders.

这篇关于我如何创建一个log4net的包装asyncronous?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆