You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2015/03/29 19:18:52 UTC

[jira] [Resolved] (LOG4NET-447) MemoryAppender class is not thread safe

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

Stefan Bodewig resolved LOG4NET-447.
------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.3.0

added PopAllEvents with svn revision 1669935.  I'm with Dominik there may be use cases where you only want to peek at the events - or only want to clear them.

> MemoryAppender class is not thread safe
> ---------------------------------------
>
>                 Key: LOG4NET-447
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-447
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.13
>         Environment: .NET Framework 4.0 (Full Profile)
>            Reporter: Gregory Babski
>            Priority: Minor
>             Fix For: 1.3.0
>
>         Attachments: MemoryAppenderTest.cs, MemoryAppender_ThreadSafety.diff
>
>
> The memory appender cannot be used safely in an application that uses more than one thread to interact with logging.
> When using this code to retrieve and then clear events logged in the memory appender:
> var events = memoryAppender.GetEvents();
> memoryAppender.Clear();
> The executing thread may be preempted between these two calls and additional logging events logged. These events are then cleared when the thread resumes execution - and are never seen/processed.
> I expect to be be able to retrieve and clear the list of current events in one call that guarantees that no events are ever lost.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)