is there a way to get a substring of the message to the nlog layout?
something like ${${substring(0,200)}message}
        <parameter name="@Summary" layout="${substring(0,200)}${message}"/>
It would be cool if that would write the equlivent of message.substring(0, 200);
    <target type="Database" name="databaseLog" 
             ConnectionStringName="ApplicationConnectionString">
        <commandText>
            INSERT INTO [Log] ([Description] ,[Summary] ,[Level] )
            VALUES            (@Description,  @Summary,  @Level  )
        </commandText>
        <parameter name="@Description" layout="${message}"/>
        <parameter name="@Summary" layout="{{SUBSTRING-OF-MESSAGE-HERE}}"/>
        <parameter name="@Level" layout="${level}"/> 
    </target> 
                You may use ${pad} layout renderer:
layout=${pad:padding=-200:fixedLength=true:inner=${message}}
Positive padding values cause left padding, negative values cause right padding to the desired width. Documentation
Or try to use T-SQL SUBSTR:
<commandText>
  INSERT INTO [Log] ([Description] ,[Summary] ,[Level] )
  VALUES (@Description,  SUBSTR(@Summary, 1, 200),  @Level)
</commandText>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With