Skip to content
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

fix: Console logging is inconsistent between Agent and Profiler #2955

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tippmar-nr
Copy link
Member

@tippmar-nr tippmar-nr commented Jan 16, 2025

Fixes #2939.

Modifies and optimizes logging behavior in the agent as follows:

NEW_RELIC_LOG_ENABLED NEW_RELIC_LOG_CONSOLE newrelic.config Result
1 0 <log enabled="true" /> File logging is enabled. Console logging is disabled. This is the default configuration.
1 1 <log enabled="true" console="true" /> File and audit logging is disabled. Console logging is enabled.
0 n/a <log enabled="false" /> All logging output is disabled (includes file, audit, event log and console).

Notes:

  • When logging is disabled, we configure a SilentLogger which is an empty implementation of the Serilog.ILogger interface. We also set the log level to off, which will short-circuit nearly all calls to the public methods in Logger.
  • Configuration in newrelic.config remains unchanged
  • Audit logging can be enabled in newrelic.config via <log enabled="true" auditLog="true" />

Profiler logging already follows this behavior so no changes were required.

Does not include tests; behavior was manually verified.

@tippmar-nr tippmar-nr requested a review from a team as a code owner January 16, 2025 21:19
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.80%. Comparing base (ee0dd2b) to head (cced557).

Files with missing lines Patch % Lines
.../NewRelic/Agent/Core/Logging/LoggerBootstrapper.cs 92.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2955      +/-   ##
==========================================
- Coverage   81.80%   81.80%   -0.01%     
==========================================
  Files         470      470              
  Lines       29949    29953       +4     
  Branches     3327     3330       +3     
==========================================
+ Hits        24499    24502       +3     
  Misses       4658     4658              
- Partials      792      793       +1     
Flag Coverage Δ
Agent 82.75% <92.00%> (-0.01%) ⬇️
Profiler 73.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../NewRelic/Agent/Core/Logging/LoggerBootstrapper.cs 77.57% <92.00%> (+1.79%) ⬆️

... and 1 file with indirect coverage changes

@tippmar-nr tippmar-nr enabled auto-merge (squash) January 17, 2025 16:59
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.

Make console logging behavior consistent between Agent and Profiler
3 participants