用\ n代替r \ n:format = @

问题描述 投票:1回答:1

当我在nlog配置中使用它时:

<attribute name="Exception" encode="false" layout="${exception:format=@}"/>

json字符串包含“ \ r \ n”。如何用“ \ n”代替?

非常感谢!Gunnar

nlog
1个回答
1
投票

您是否尝试过使用此功能:

${replace:searchFor=\\\\r\\\\n:replaceWith=\\\\n:inner=${exception:format=@}}

另请参见:https://github.com/nlog/NLog/wiki/Replace-Layout-Renderer

© www.soinside.com 2019 - 2024. All rights reserved.