Please Help...Records in excess of 500 does not get saved to DB using NLog

2 messages Options
Embed this post
Permalink
Suresh.M.P

Please Help...Records in excess of 500 does not get saved to DB using NLog

Reply Threaded More More options
Print post
Permalink
Using Nlog i am trying to save records in excess of 500 but out of 500 only 130 records get saved but if record count is 100 or less than that then all records are saved.

I am using NLog.Config and contents of NLog.config is as given below..Any help is higly appreciated as i have no clue what may be the cause of the problem.

<targets>
    <target xsi:type="AsyncWrapper" name="database">
      <!--<target xsi:type="RetryingWrapper" retryCount="5">-->
      <target xsi:type="Database" connectionString="Data Source=Test; Initial Catalog=Test;User Id=user;Password=test" >
        <!--<useTransactions>true</useTransactions>
        <keepConnection>true</keepConnection>-->
        <commandText>
          EXEC dbo.WriteLogAndCategoryLog @EventID, @Priority, @Severity, @Title, @TimeStamp,@MachineName, @AppDomainName, @ProcessID, @ProcessName,
                                          @ThreadName, @Win32ThreadId, @Message, @FormattedMessage , @CategoryID;
        </commandText>

        <parameter name="@EventID" layout="1" />
        <parameter name="@Priority" layout="1" />
        <parameter name="@Severity" layout="${level}" />
        <parameter name="@Title" layout="Test by NLog"/>
        <parameter name="@TimeStamp" layout="${date}"/>
        <parameter name="@MachineName" layout="${machinename}"/>
        <parameter name="@AppDomainName" layout="AppDomainName Test by NLog"/>
        <parameter name="@ProcessID" layout="${processid}"/>
        <parameter name="@ProcessName" layout="${processname}"/>
        <parameter name="@ThreadName" layout="${threadname}"/>
        <parameter name="@Win32ThreadId" layout="${threadid}"/>
        <parameter name="@Message" layout="${message}"/>
        <parameter name="@FormattedMessage" layout="${stacktrace}"/>
        <parameter name="@CategoryID" layout="1"/>
      </target>
        </target>
     </targets>

Thanks
Jaroslaw Kowalski

Re: Please Help...Records in excess of 500 does not get saved to DB using NLog

Reply Threaded More More options
Print post
Permalink
You can typically debug those kinds of issues by adding throwExceptions="true" to <nlog /> element. This will bubble up any errors that are being thrown during execution.

Let me know if it allows you to diagnose the issue.