FreeAndNil opened a new issue, #356:
URL: https://github.com/apache/logging-log4net/issues/356

   Events logged through `ILog` can lose their location information 
(`%location`, `%method`, `%line`, `%stacktrace`) once the JIT optimizes the 
logging methods of `LogImpl`.
   
   `LocationInfo` finds the caller by looking for the `LogImpl` frame on the 
stack. An optimizing JIT can inline `LogImpl.Info` and friends, or turn their 
call to `Logger.Log` into a tail call. The `LogImpl` frame is then gone and the 
location stays empty.
   
   Seen on Linux x64 with .NET 10 in a Release build: 
`PatternLayoutTest.TestStackTracePattern` fails once the methods reach tier 1, 
and always with `DOTNET_TieredCompilation=0`. CI runs the tests in Debug only, 
so it never showed up there.
   
   Fix: `MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization` on 
the logging methods of `LogImpl`, and Release builds in CI.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [I] Location information lost wh... FreeAndNil (via GitHub) via notifications

Reply via email to