| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Value from the App Settings configuration (app.config / web.config)
Platforms Supported: Limited (.NET Framework only, when using .NET Core then ${configsetting} can be used to read values from appsettings.json-file)
Introduced with NLog 3.0 and with NLog 4.6+ it was included in default NLog-package without needing NLog.Extended.
${appsetting:item=String:default=String}
Introduced with NLog v4.5, and replaces the Name-option.
Example .config
<configuration>
<appSettings>
<add key="MyKey" value="MyApplication" />
</appSettings>
</configuration>Example renderer: produces MyApplication is this case:
${appsetting:item=MyKey:default=mydefault}
Example#2 renderer: produces mydefault is this case:
${appsetting:item=MyKey2:default=mydefault}
Introduced with NLog 4.6.5
<configuration>
<appSettings>
<add key="MyKey" value="MyApplication" />
</appSettings>
<connectionStrings>
<add name="ElasticUrl" connectionString="http://localhost:9200"/>
</connectionStrings>
</configuration>Example#3 renderer: produces http://localhost:9200 is this case:
${appsetting:item=connectionStrings.ElasticUrl}
Note remember to uninstall/remove NLog.Extended-nuget-package from the application when having upgraded to NLog v4.6.5, else connectionStrings-lookup will not work.
- Troubleshooting Guide - See available NLog Targets and Layouts: https://nlog-project.org/config
| Back | FazBrowse Home | New Git URL |