-
Notifications
You must be signed in to change notification settings - Fork 165
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
ASP.NET Core: Improved ConfigureNLog for better out-of-the-box experience #268
Conversation
…LL has been loaded.
Codecov Report
@@ Coverage Diff @@
## master #268 +/- ##
=====================================
Coverage 57% 57%
=====================================
Files 31 31
Lines 407 407
Branches 92 92
=====================================
Hits 233 233
Misses 138 138
Partials 36 36 Continue to review full report at Codecov.
|
@@ -11,7 +11,7 @@ public static class Program | |||
{ | |||
public static void Main(string[] args) | |||
{ | |||
var logger = NLog.LogManager.LoadConfiguration("nlog.config").GetCurrentClassLogger(); | |||
var logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger(); |
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.
mmm maybe this needs a minor version change, because of changed api usage.
(4.6 instead of 4.5.1)
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.
As the two bug-issues has shown, then 4.5.0 is not working that well out of the box (actually very broken). Think 4.5.1 would be fine. Unless you have a good idea for how to pre-register when AspNetCore?
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.
OK, thanks, NLog.LogManager.LoadConfiguration
still works of course (in the same bugged way)
Do we need this also for non ASP? e.g. |
Maybe |
Yes, I think that's a good idea. PS: Now building a new release for nlog.web.aspnetcore |
release will be probably "tomorrow". Have a good night! |
NLogBuilder is needed, because DLL autoload doesn't work - this will replace replace LoadConfiguration with ConfigureNLog
unless the DLL has been loaded.
Resolves #267 + Resolves #264
The example project was cheating as it had a direct reference to "NLog.Web.AspNetCore". After removing project-reference and using nuget-package, then it pre-loaded differently.