Skip to content

log4net to Serilog: Log format cleanup / rework #1672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

tippmar-nr
Copy link
Member

Fixed some issues with log formatting, particularly in the Audit log output. Added another Serilog package to help with defining the log format similarly to the way we did with log4net.

Modified the various XxxFormat() methods to pass the format string and args through to Serilog, which ensures proper formatting of the string especially when the format string contains embedded JSON.

Also re-worked the guard checks in Logger.cs and Log.cs so that the check is made at the lowest level.

@tippmar-nr
Copy link
Member Author

Waiting on a green CI run before I merge. Not positive I've got all the edge cases handled yet.

@codecov-commenter
Copy link

Codecov Report

Merging #1672 (a001672) into feature/log4net-to-serilog (98dfc0d) will increase coverage by 0.13%.
The diff coverage is 83.78%.

Impacted file tree graph

@@                      Coverage Diff                       @@
##           feature/log4net-to-serilog    #1672      +/-   ##
==============================================================
+ Coverage                       82.41%   82.55%   +0.13%     
==============================================================
  Files                             389      385       -4     
  Lines                           24180    24151      -29     
==============================================================
+ Hits                            19929    19937       +8     
+ Misses                           4251     4214      -37     
Impacted Files Coverage Δ
.../NewRelic/Agent/Core/Logging/LogLevelExtensions.cs 96.55% <0.00%> (-3.45%) ⬇️
src/Agent/NewRelic/Agent/Core/Logging/AuditLog.cs 72.72% <66.66%> (-27.28%) ⬇️
src/NewRelic.Core/Logging/Log.cs 84.81% <83.33%> (+0.27%) ⬆️
.../NewRelic/Agent/Core/Logging/LoggerBootstrapper.cs 81.08% <90.90%> (+10.75%) ⬆️
src/Agent/NewRelic/Agent/Core/Logging/Logger.cs 96.25% <100.00%> (+0.25%) ⬆️

... and 5 files with indirect coverage changes

Copy link
Member

@jaffinito jaffinito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work here!

@tippmar-nr tippmar-nr merged commit 2cddfb1 into feature/log4net-to-serilog May 30, 2023
@tippmar-nr tippmar-nr deleted the feature-work/serilog-log-format-rework branch May 30, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants