NLog / NLog.Extensions.Logging

NLog as Logging Provider for Microsoft Extension Logging
https://nlog-project.org
BSD 2-Clause "Simplified" License
392 stars 151 forks source link

NLogLoggerFactory - ReOptimize concurrency for CreateLogger #769

Closed RockNHawk closed 1 week ago

RockNHawk commented 1 week ago

ReOptimize concurrency for CreateLogger. Followup to #692

codecov-commenter commented 1 week ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.75%. Comparing base (71af10a) to head (845ba8c).

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #769 +/- ## ========================================== - Coverage 81.76% 81.75% -0.02% ========================================== Files 19 19 Lines 1810 1803 -7 Branches 321 320 -1 ========================================== - Hits 1480 1474 -6 Misses 188 188 + Partials 142 141 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

snakefoot commented 1 week ago

Thank you for your contribution, but I prefer to stay aligned with the official LoggerFactory from DotNet-runtime:

https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Logging/src/LoggerFactory.cs

See also: https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-8/#logging

Or do you experience performance issue on docker-images with restricted number of cpu-cores?

RockNHawk commented 1 week ago

Thank you for your contribution, but I prefer to stay aligned with the official LoggerFactory from DotNet-runtime:感谢您的贡献,但我更愿意与 DotNet-runtime 的官方 LoggerFactory 保持一致:

https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Logging/src/LoggerFactory.cs

See also: https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-8/#logging另请参阅:https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-8/#logging

Or are you experience performance issue on docker-images with restricted number of cpu-cores?或者您是否在 cpu 内核数量受限的 docker-images 上遇到性能问题?

Okay, maybe I need a performance test to compare which is faster, ConcurrentDictionary also uses lock within TryAdd, but it's a fine-grained one.