NLog.Extensions.Logging: ConnectionStringName not supported on NLog DatabaseTarget with NetCore
Hi, I get an error:
2016-08-24 10:32:55.0195 Error Error has been raised. Exception: System.NotSupportedException: Parameter connectionStringName not supported on DatabaseTarget
Can’t i use
<target name="database" xsi:type="Database" connectionStringName="logConnection">
in a Core app?
logConnection
is configured in the JSON config file.
Also for
<target name="file"
xsi:type="File"
fileName="${basedir}/Logs/${shortdate}.txt"
layout="${date:format=dd.MM.yyyy hh\:mm\:ss} [${level}] ${newline} ${newline} [${callsite}] ${newline} ${message} ${newline} ${newline} ${stacktrace} ${newline} ${newline}${exception:format=ToString} ${newline} ${newline}" />
I don’t get any output.
Thanks
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (8 by maintainers)
@mottykohn
connectionStringName
is for .NetFramework and app.config. When using .NetCore and appsetting.json then you can make use of${configsetting}
. Like this:It will lookup the value in
appsettings.json
:See also: https://github.com/NLog/NLog/wiki/ConfigSetting-Layout-Renderer
Thanks, that worked!