[ 
https://issues.apache.org/jira/browse/LOG4NET-239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dominik Psenner updated LOG4NET-239:
------------------------------------

    Priority: Minor  (was: Major)
    
> LoggingEvent m_cacheUpdatable is useless and even produce an unexpected 
> behavior
> --------------------------------------------------------------------------------
>
>                 Key: LOG4NET-239
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-239
>             Project: Log4net
>          Issue Type: Test
>    Affects Versions: 1.2.10
>         Environment: .Net 2.0
>            Reporter: François Dumont
>            Priority: Minor
>
> I already notify my problem on the mailing but as I had no answer I finally 
> prefered to report it here. Rather than copy/paste my mail I prefered to 
> write a test that has to be added to the BufferingAppenderTest:
>         [Test, Description("Check that use of the BufferingAppender shall not 
> change the rendering of the log event.")]
>         public void TestAppenderSkeletonBehavior()
>         {
>             SetupRepository();
>             ObserverAppender observer = new ObserverAppender();
>             m_bufferingForwardingAppender.AddAppender(observer);
>             ILogger logger = m_hierarchy.GetLogger("test");
>             logger.Log(typeof(BufferingAppenderTest), Level.Warn, "Message", 
> new Exception("Exception"));
>             Assert.AreEqual(1, observer.EventsCount);
>             LoggingEvent loggingEvent1 = observer.Dequeue();
>             // Lets see what happen if we do not fix the exception part of 
> the logging event at the
>             // buffering forwarding appender level and let underlying 
> appenders deal with it:
>             m_bufferingForwardingAppender.Fix ^= FixFlags.Exception;
>             logger.Log(typeof(BufferingAppenderTest), Level.Warn, "Message", 
> new Exception("Exception"));
>             Assert.AreEqual(1, observer.EventsCount);
>             LoggingEvent loggingEvent2 = observer.Dequeue();
>             // The two logging events shall be similar:
>             Assert.AreEqual(loggingEvent1.Level, loggingEvent2.Level);
>             Assert.AreEqual(loggingEvent1.Domain, loggingEvent2.Domain);
>             // Lets check the appender skeleton behavior: it normally renders 
> the exception string info
>             // if the layout do not do so invoking the GetExceptionString 
> method.
>             Assert.IsNotNull(loggingEvent1.GetExceptionString(),
>                              "Missing exception information when buffering 
> appender fix it !");
>             Assert.IsNotNull(loggingEvent2.GetExceptionString(),
>                             "Missing exception information when buffering 
> appender do not fix it !");
>         }
> This test needs this following small appender implementation to work:
>     internal sealed class ObserverAppender : AppenderSkeleton
>     {
>         private readonly Queue<LoggingEvent> loggingEvents;
>         public int EventsCount
>         {
>             get { return this.loggingEvents.Count; }
>         }
>         public ObserverAppender()
>         {
>             this.loggingEvents = new Queue<LoggingEvent>();
>         }
>         protected override void Append(LoggingEvent loggingEvent)
>         {
>             this.loggingEvents.Enqueue(loggingEvent);
>         }
>         public LoggingEvent Dequeue()
>         {
>             return this.loggingEvents.Dequeue();
>         }
>     }
> For info I try to comment m_cacheUpdatable = false and notice no regression 
> when running tests. I would really be interested in knowing what this flag is 
> for ?
> Thanks

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to