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 "JOHN Alexander ZABROSKI (JIRA)" <ji...@apache.org> on 2015/08/05 21:50:05 UTC

[jira] [Commented] (LOG4NET-469) Fixes for the LogicalThreadContext - NDC stack is wrong

    [ https://issues.apache.org/jira/browse/LOG4NET-469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14658757#comment-14658757 ] 

JOHN Alexander ZABROSKI commented on LOG4NET-469:
-------------------------------------------------

What .NET version number did this problem occur on?

With the new RyuJIT optimization bugs becoming mainstream knowledge, I wonder if we need to add a custom field to JIRA to track which release of .NET the reporter is using.

Further, are you running .NET 4.6 with Optimization enabled?

> Fixes for the LogicalThreadContext - NDC stack is wrong
> -------------------------------------------------------
>
>                 Key: LOG4NET-469
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-469
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.0
>            Reporter: Maxim Cherednik
>             Fix For: 1.3.0
>
>
> This is related to issue number 455. (Link to github: https://github.com/apache/log4net/pull/12)
> I was playing around with this fix recently and came across some strange behavior.
> Imagine main method:
> {code:title=main.cs|borderStyle=solid}
> using (LogicalThreadContext.Stacks["NDC"].Push("Start"))
> {
>     // init all the stuff here
>     _timer.TimerElapsed += TimerOnTimerElapsed;
> }
> {code}
> An that would be it.
> When I am on the timer tick event I have another context:
> {code:title=timer.cs|borderStyle=solid}
> using (LogicalThreadContext.Stacks["NDC"].Push("timer"))
> {
>     Logger.Info("I am doing something here. Show me the context");
> }
> {code}
> As a result expect to see the context of the timer like this: "timer", 
> instead, I see: "Start timer"
> Is this correct behavior?



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