-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
AppSetting Layout Renderer not read from appsettings.json #2274
Comments
internal log |
after change application by NLog/NLog.Web#34 at NLog.Config.Factory 2.TryCreateInstance(String itemName, TBaseType& result) at NLog.Config.LayoutRendererFactory.TryCreateInstance(String itemName, LayoutRenderer& result) at NLog.Config.Factory 2.CreateInstance(String name)at NLog.Layouts.LayoutParser.ParseLayoutRenderer(ConfigurationItemFactory configurationItemFactory, SimpleStringReader sr) |
appsettings.json is not supported yet. |
Is NLog.Extended work under .core 2.0? Can I create an app.config and use it? |
@carkov1990 Work around is just to manual assign a NLog-global-variable to the wanted json-appsettings-value. |
Nope not ported yet. |
@carkov1990 Hello, I created a package to access appsettings.json that worked fine under .net core2.0, you can consider it. |
@linmasaki nice! I would recommend to split your package and create 2 packages. It's better to find and the dependencies are more in control. e.g. NLog.Appsettings.Json and NLog.AzureAppendBlob |
@304NotModified Thank you for your suggestion!!! I will split the package soon(AzureAppendBlob already had). I thought this package could provide somebody who prefer all in one like me 😄 |
@carkov1990 @304NotModified Hello, I had split it finished, if you are interested or needed, check this package , Thank you~ |
@linmasaki nice! Added it here: https://github.com/NLog/NLog/wiki/Layout-Renderers#external-packages |
With NLog.Extension.Logging ver. 1.4.0 then you can now use See also: https://github.com/NLog/NLog/wiki/ConfigSetting-Layout-Renderer |
Type: Question
NLog version:
<PackageReference Include="NLog" Version="5.0.0-beta09" />
<PackageReference Include="NLog.Extended" Version="4.4.0-rc1" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.0.0-rtm-beta5" />
<PackageReference Include="NLog.Targets.ElasticSearch" Version="4.0.0-beta21" />
Platform: .NET Core 2.0 Console Application
Current NLog config
<variable name="env" value="${whenEmpty:whenEmpty=DEV-${machinename:uppercase=true}:inner=${appsetting:name=Environment:uppercase=true}}" />
Current appsettings.json
{
"appSettings": {
"Environment": "QA"
}
}
appsettings.json always copy
Variable env always equals DEV-{machinename}. I expected QA. Where I was mistaken and why the variable is always equal to DEV- {machinename}
The text was updated successfully, but these errors were encountered: