-
Notifications
You must be signed in to change notification settings - Fork 163
Description
Bug(?)/Improvement(?)
NLog version: 4.6.8
NLog.Extensions.Logging version: 1.6.1
NLog.Web.AspNetCore version: 4.9.0
Platform: .NET Framework 4.8, .NET Core 3.1, .NET Standard 2.0
Currently there are features that could be universally supported for all applications referencing the Microsoft.Extensions.Hosting generic application host but that are only currently supported in ASP.NET Core (e.g. ${aspnet-environment}). Since ASP.NET Hosting now uses Microsoft.Extensions.Hosting and desktop applications that are likely to use Microsoft.Extensions.Logging will often do so through Microsoft.Extensions.Hosting going forward it seems like the feature support (and dependency hierarchy) should be organized in the same order as the Microsoft types (i.e. since Microsoft's Dependencies go ASP.NET -> Microsoft.Extensions.Hosting -> Microsoft.Extensions.Logging it would be ideal for NLog dependencies to mirror this, e.g. NLog.Web.AspNetCore -> NLog.Extensions.Hosting -> NLog.Extensions.Logging)
One reason this comes up for us is because we use Microsoft.Extensions.Hosting for a single product that contains both .NET 4.8 and .NET Core 3.1 applications. For re-use and establishing base patterns we have various hosting libraries with extension methods to set the hosts up the way we like and since our general NLog extensions (we have custom formatters, conditions, etc.) and common NLog.config file are universal they are defined in a library that also exposes the extension methods designed to be used with Microsoft.Extensions.Hosting. Now that we're adding an ASP.NET Core hosting library, it references NLog.Web.AspNetCore as well as our NLog package (and therefore references NLog.Extensions.Hosting).
We would really like to use the environment name in our universal config file but they are currently only features of the ASP.NET Core. Additionally we would like our dependency hierarchies for the packages we're generating and consuming to match up to reduce risk of divergence in the future (this hasn't caused an critical issues yet so far as I can tell, but it seems like it would make sense).