FreeAndNil commented on PR #357:
URL: https://github.com/apache/logging-log4net/pull/357#issuecomment-7048062406
Implementation plan for #357, kept here for the record. Written up to
describe the change as it stands on the branch.
<details>
<summary>Plan</summary>
# Keep the LogImpl frame for location information (#356)
## Context
Events logged through `ILog` can lose their location information
(`%location`, `%method`, `%line`,
`%stacktrace`) once the JIT optimizes the logging methods of `LogImpl`. 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`.
## Constraints that shape the design
- `LocationInfo` finds the caller by looking for the `LogImpl` frame on the
stack.
- An optimizing JIT may inline `LogImpl.Info` and friends, or turn their
call to `Logger.Log` into a
tail call; either removes the frame.
- CI built and tested in Debug only, so optimized code never ran there.
## Changes
1. `MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization` on all
35 logging methods of
`LogImpl`.
2. CI builds and tests in Release, as shipped and as `build-release.ps1`
tests.
3. `LogImplTest` checks by reflection that every logging method carries both
options.
One changelog entry in `src/changelog/3.6.0`.
## Verification
- `PatternLayoutTest.TestStackTracePattern` in Release with
`DOTNET_TieredCompilation=0`, before and
after.
- The full suite in Release on CI, net10 and net462.
</details>
--
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]