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 "Mike Barry (JIRA)" <ji...@apache.org> on 2014/08/20 15:42:27 UTC

[jira] [Updated] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await

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

Mike Barry updated LOG4NET-437:
-------------------------------

    Attachment: Program.cs

Demos the issue

> LogicalThreadContext data does not flow properly using Async and Await
> ----------------------------------------------------------------------
>
>                 Key: LOG4NET-437
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-437
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.9, 1.2.10, 1.2.11, 1.2.12, 1.2.13
>         Environment: Windows 7, .NET 4.5
>            Reporter: Mike Barry
>         Attachments: LogicalThreadContext.diff, Program.cs, ThreadContextStacks.diff
>
>
> LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets corrupted because the logical data context is not immutable. (See: http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net the thread context is corrupted compared to the proper implementation in MyStack and the console logger. An entry like:
> LOG4NET Main 1 A 2 A: </MoreWork>
> LOG4NET Main 1 A 2 A: </MoreWork>
> is invalid and should not be possible in a properly working thread context.



--
This message was sent by Atlassian JIRA
(v6.2#6252)