You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Davyd McColl (Jira)" <ji...@apache.org> on 2022/07/22 11:44:00 UTC

[jira] [Commented] (LOG4NET-684) Log4Net logs incorrect data

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

Davyd McColl commented on LOG4NET-684:
--------------------------------------

The code in question uses the [ThreadStatic] attribute on the storing field and the field is lazily-initialized, as per https://docs.microsoft.com/en-us/dotnet/api/system.threadstaticattribute?view=netcore-3.1. I've also added a test to prove that it is thread-static: spin up 256 threads and smash a property 100000 times per thread - takes about 5s to run on my machine. No failures. Either you have a specific issue with the dotnet runtime on the host machine(s) or the error could perhaps be in `Utility.Helpers.General.GetIpAddressFromHttpRequest()`. Closing as unreproducable.

> Log4Net logs incorrect data
> ---------------------------
>
>                 Key: LOG4NET-684
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-684
>             Project: Log4net
>          Issue Type: Bug
>         Environment: asp.net core 3.1
>            Reporter: Yesto Fringen
>            Priority: Critical
>
> When two log have requested at near times, extra informations can be overwritten.
> For Ex: we store ip addresses and wrong ip address can be written in logs.
>  
> {code:java}
> ThreadContext.Properties["ipAddress"] = Utility.Helpers.General.GetIpAddressFromHttpRequest(); {code}
>  
> We use asp.net core 3.1.
> I have tried GlobalContext, ThreadContext and LogicalThreadContext, nothing changed.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)