Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Configuration file for NLog when using SQL Server stored procedures as a target. See http://dougv.us/r6 for more info.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off">
<targets>
<target
xsi:type="Database"
name="d"
dbProvider="System.Data.SqlClient"
connectionStringName="DefaultConnection"
commandText="EXEC NLogErrorLogInsert @errordate, @source, @level, @message"
>
<parameter name="@errordate" layout="${date:universalTime=true:format=s}" />
<parameter name="@source" layout="${machinename}" />
<parameter name="@level" layout="${level:uppercase=true}" />
<parameter name="@message" layout="${message}" />
</target>
</targets>
<rules>
<logger name="*" minlevel="Warn" writeTo="d" />
</rules>
</nlog>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.