【发布时间】:2019-05-02 03:29:36
【问题描述】:
有没有办法将消息的子字符串获取到 nlog 布局?
类似${${substring(0,200)}message}
<parameter name="@Summary" layout="${substring(0,200)}${message}"/>
如果能写出 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>
【问题讨论】: