-
Notifications
You must be signed in to change notification settings - Fork 65
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
Adds support for NLog to application logging #1087
Conversation
- Update the msiinstaller solution to include new wrappers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed in pairing, and this looks ready to ship!
...edApplications/Common/MultiFunctionApplicationHelpers/MultiFunctionApplicationHelpers.csproj
Outdated
Show resolved
Hide resolved
...edApplications/Common/MultiFunctionApplicationHelpers/MultiFunctionApplicationHelpers.csproj
Show resolved
Hide resolved
src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/NLogLogging/NLogWrapper.cs
Outdated
Show resolved
Hide resolved
{ | ||
var logconsole = new ConsoleTarget(); | ||
|
||
NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(logconsole, LogLevel.Debug); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use isolated NLog.LogFactory like this:
var logFactory = new NLog.LogFactory();
var logConfig = new NLog.Config.LoggingConfiguration();
var logConsole = new ConsoleTarget();
if (layoutOverride != null)
logConsole = layoutOverride;
logConfig.AddTarget("console", logConsole);
logConfig.LoggingRules.Add(new NLog.Config.LoggingRule("*", NLog.LogLevel.Trace, logConsole));
logFactory.Configuration = logConfig;
return logFactory.GetLogger("LoggingTest");
Then ConfigureJsonLayoutAppenderForDecoration()
can provide its JsonLayout as layoutOverride
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this! I updated the adapter to setup the log this and all the tests passed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty solid to me. Some minor comments that don't need to be addressed.
Would recommend the testing on the actual 5.0 version in this or a follow-up PR.
I did notice we access an internal "Message"
property taht seems like we are assuming can never be null. Which may be the case but seems maybe slightly less guaranteed than a "FormattedMessage" without looking at the code. Just calling out to make sure that was known given we do string appending.
Description
Author Checklist
Reviewer Checklist