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: Update Serilog EventLog sink configuration to enable event source creation. #1963

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

tippmar-nr
Copy link
Member

Enables the manageEventSource parameter on the SeriLog EventLog() sink constructor. This will allow the Agent to attempt to create the New Relic .NET Agent event source on the local machine if it doesn't exist. Note that this attempt will only succeed if the application is running with Administrator privileges. Note that this code is currently applicable only to .NET Framework applications.

If source creation fails, Serilog will catch the exception internally. I've also added a just-in-case try/catch block around the call to configure the EventLog sink. In any case, the Agent will continue to operate, though it will be unable to log to EventLog.

…e creation (if the app is running with admin privileges).
@codecov-commenter
Copy link

Codecov Report

Merging #1963 (1d070db) into main (a05dc2a) will decrease coverage by 0.01%.
Report is 1 commits behind head on main.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1963      +/-   ##
==========================================
- Coverage   83.58%   83.58%   -0.01%     
==========================================
  Files         402      402              
  Lines       24623    24629       +6     
==========================================
+ Hits        20581    20585       +4     
- Misses       4042     4044       +2     
Files Coverage Δ
.../NewRelic/Agent/Core/Logging/LoggerBootstrapper.cs 79.87% <83.33%> (-1.22%) ⬇️

... and 3 files with indirect coverage changes

@tippmar-nr tippmar-nr merged commit 274072b into main Oct 10, 2023
76 checks passed
@tippmar-nr tippmar-nr deleted the bugfix/event-log-source-manage-parameter branch October 10, 2023 13:52
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.

None yet

4 participants