• log4net RemotingAppender


    RemotingAppender

    For full details see the SDK Reference entry: log4net.Appender.RemotingAppender.

    The following example shows how to configure the RemotingAppender to deliver logging events to a specified Sink (in this example the sink is tcp://localhost:8085/LoggingSink). In this example the events are delivered in blocks of 95 events because of the BufferSize. No events are discarded. The OnlyFixPartialEventData option allows the appender to ignore certain logging event properties that can be very slow to generate (e.g. the calling location information).

    1. <appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
    2. <sink value="tcp://localhost:8085/LoggingSink" />
    3. <lossy value="false" />
    4. <bufferSize value="95" />
    5. <onlyFixPartialEventData value="true" />
    6. </appender>

    This example configures the RemotingAppender to deliver the events only when an event with level ERROR or above is logged. When the events are delivered, up to 200 (BufferSize) previous events (regardless of level) will be delivered to provide context. Events not delivered will be discarded.

    1. <appender name="RemotingAppender" type="log4net.Appender.RemotingAppender" >
    2. <sink value="tcp://localhost:8085/LoggingSink" />
    3. <lossy value="true" />
    4. <bufferSize value="200" />
    5. <onlyFixPartialEventData value="true" />
    6. <evaluator type="log4net.Core.LevelEvaluator">
    7. <threshold value="ERROR"/>
    8. </evaluator>
    9. </appender>

    RemotingAppender Class

    Remarks

     

    This Appender is designed to deliver events to a remote sink. That is any object that implements the RemotingAppender. IRemoteLoggingSink interface. It delivers the events using .NET remoting. The object to deliver events to is specified by setting the appenders Sink property.

    The RemotingAppender buffers events before sending them. This allows it to make more efficient use of the remoting infrastructure.

    Once the buffer is full the events are still not sent immediately. They are scheduled to be sent using a pool thread. The effect is that the send occurs asynchronously. This is very important for a number of non obvious reasons. The remoting infrastructure will flow thread local variables (stored in the CallContext), if they are marked as ILogicalThreadAffinative, across the remoting boundary. If the server is not contactable then the remoting infrastructure will clear the ILogicalThreadAffinative objects from the CallContext. To prevent a logging failure from having side effects on the calling application the remoting call must be made from a separate thread to the one used by the application. A ThreadPool thread is used for this. If no ThreadPool thread is available then the events will block in the thread pool manager until a thread is available.

    Because the events are sent asynchronously using pool threads it is possible to close this appender before all the queued events have been sent. When closing the appender attempts to wait until all the queued events have been sent, but this will timeout after 30 seconds regardless.

    If this appender is being closed because the ProcessExit event has fired it may not be possible to send all the queued events. During process exit the runtime limits the time that a ProcessExit event handler is allowed to run for. If the runtime terminates the threads before the queued events have been sent then they will be lost. To ensure that all events are sent the appender must be closed before the application exits. See Shutdown() for details on how to shutdown log4net programmatically.

  • 相关阅读:
    <2016-1-28>
    <页面里折合与打开>
    右上角鼠标滑过展开收缩动画效果js代码的演示页面
    30款css3实现的鼠标经过图片显示描述特效
    dede让channelartlist标签支持currentstyle属性 完美解决
    织梦导航 currentstyle 点击li添加class类 样式
    论坛首页显示板块,但没有权限点不进去
    医疗窗口右下角弹出抖动效果
    joomla搬家之后打不开 首页404错误
    Discuz X3游客看小图功能导致文字内容隐藏的【修复方法】
  • 原文地址:https://www.cnblogs.com/chucklu/p/13225560.html
Copyright © 2020-2023  润新知