nlogレイアウトにメッセージの部分文字列を取得する方法はありますか?それはmessage.substringのequlivent(0、200)を記述した場合${${substring(0,200)}message}
レイアウトのnlogサブストリング
<parameter name="@Summary" layout="${substring(0,200)}${message}"/>
よう 何かがそれはクールになります。
<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>
Sqlサブストリングがありがたいです – eiu165
SUBSTRはSQLのSUBSTRING(@Summary、1、200)である必要があります – eiu165
$ {pad}の問題は、文字列がパディング長よりも小さい場合、実際に空白で埋められるということです。したがって、部分文字列ではありません。 TSQLソリューションは一般的に対象には適用されません。 – AlexP