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

Introduced AddNLogWeb to avoid conflict with AddNLog from NLog.Extension.Logging #602

Merged
merged 1 commit into from
Sep 26, 2020

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Aug 19, 2020

Reduce the level of confusion when used within services.AddLogging()-method. See also NLog/NLog#4090

Like this:

            services.AddLogging(loggingBuilder =>
            {
                loggingBuilder.ClearProviders();
                loggingBuilder.AddNLogWeb(); // fix Missing serviceProvider, so no HttpContext
            });

Instead of this:

            services.AddLogging(loggingBuilder =>
            {
                loggingBuilder.ClearProviders();
                loggingBuilder.AddNLog(provider => null);  // fix Missing serviceProvider, so no HttpContext
            });

Guess when NLog.Extension.Logging ver. 2 with released with NLog ver. 5.0, then AddNLog can be marked as obsolete (Redirect to AddNLogWeb)

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@snakefoot
Copy link
Contributor Author

snakefoot commented Aug 20, 2020

An alternative could be to also have LoadConfigurationFromSection in NLog.Web-namespace. Thus avoiding the need to have both using NLog.Web and using NLog.Logging.Extensions (Continue to have methods with name-conflicts, but making it obvious that they have different features)

@304NotModified
Copy link
Member

An alternative could be to also have LoadConfigurationFromSection in NLog.Web-namespace. Thus avoiding the need to have both using NLog.Web and using NLog.Logging.Extensions

Related: NLog/NLog.Extensions.Logging#421

@304NotModified 304NotModified merged commit 8e2823a into NLog:master Sep 26, 2020
@304NotModified
Copy link
Member

An alternative could be to also have LoadConfigurationFromSection in NLog.Web-namespace. Thus avoiding the need to have both using NLog.Web and using NLog.Logging.Extensions (Continue to have methods with name-conflicts, but making it obvious that they have different features)

That's fine, in the end we will move everything to Microsoft.Extensions.DependencyInjection namespace, see NLog/NLog.Extensions.Logging#421. But that will be the next major version I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ASP.NET Core ASP.NET Core - all versions feature size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants