1

I am working on a project which need to log SOAP messages request. Some requests have very large string more then 14 million XML characters. Issue is when these kind of messages are send to database, these messages are not saved neither any kind of exception occur in application. I try to switch on N-Log exception property but nothing happened. You can find my configuration settings below

<targets> 
    <target name="main" xsi:type="AutoFlushWrapper" asyncFlush="true"> 
        <target name="database_buffer" 
                xsi:type="BufferingWrapper" 
                bufferSize="50" 
                flushTimeout="120000"> 
            <target xsi:type="FallbackGroup" 
                    name="String" 
                    returnToFirstOnSuccess="true"> 
                <target xsi:type="Database" 
                        name="database_inner" 
                        connectionString="${event-context:item=dbConnectionString}" 
                        commandText="INSERT INTO [Log] ([Level],[Message],[Application],[MethodInfo],[Exception]) VALUES(@Level,@Message,@ApplicationName,@MethodInfo,@Exception)"> 
                    <parameter name="@Level" layout="${level:uppercase=true}" />
                    <parameter name="@Message" layout="${event-properties:item=Message}" />
                    <parameter name="@ApplicationName" layout="${event-properties:item=SourceName}" /> 
                    <parameter name="@MethodInfo" layout="${event-properties:item=MethodInfo}" />
                    <parameter name="@Exception" layout="${event-properties:item=Exception}" />
                </target>
            </target> 
        </target> 
    </target> 
</targets>

There is no internal log file created or application crash in debug mode. On the same end small strings and normal length messages are successfully going into database. In database I have Nvarchar Max datatype for column.

I can't find option here to upload file so I am attaching this link to download exact message which I am trying to save in database. Here is it.

This file text successfully insert in database when I remove Buffer and asynchronously options or I insert with Ado.net components. So please guide me the where I am wrong and what is the issue.

Rolf Kristensen
  • 17,785
  • 1
  • 51
  • 70
Tabraiz
  • 31
  • 5
  • Maybe you need to convert the string to `nvarchar(max)`. See also https://stackoverflow.com/questions/4833549/nvarcharmax-still-being-truncated . But this is not possible in NLog-database-target until this has been fixed: https://github.com/NLog/NLog/pull/2767 – Rolf Kristensen Aug 28 '18 at 20:58
  • Actually this is not a issue with sql datatype. N-log not sending any kind of request to server to log information. I checked via sql-profiler. I have idea that select statement have charters limit and it can be increased decreased from tools options. – Tabraiz Aug 29 '18 at 08:09

0 Answers0