I am having a bit of a problem using a stored procedure instead of a SQL INSERT statement when using NLog in a C# web application. The connection string "Logger" is correctly configured in Web.config and works properly when replacing the commandText with a SQL statement. I would appreciate a hint in the right direction. In this example the stored procedure is under the "Logs" schema and it is called "LogError".
<targets>
<target xsi:type="Database"
name="dberrorlog"
connectionStringName="Logger"
keepConnection="true"
commandText="[Logs].[LogError]" >
<parameter name="@ProgName" layout="MyAppName"/>
<parameter name="@CompName" layout="${machinename}"/>
<parameter name="@LogLevel" layout="${level}"/>
<parameter name="@UserName" layout="${identity}"/>
<parameter name="@Error" layout="${exception:format=Message}"/>
<parameter name="@SourceObj" layout="${exception:format=Method}"/>
<parameter name="@StackTrace" layout="${exception:format=StackTrace}"/>
</target>
</targets>
<rules>
<logger name="*" minlevel="Error" writeTo="dberrorlog" />
</rules>