【发布时间】:2017-03-31 04:54:52
【问题描述】:
在 Nlog 4.4.5 中,我尝试使用 WebService 目标的协议 JsonPost 将日志发布到 slack。 Slack webhook 需要通过 https 发布的 Json 数据 (https://api.slack.com/incoming-webhooks)
<target xsi:type="WebService"
name="slack"
url="https://hooks.slack.com/services/T*****/B4T****/7F********XDv9h/"
protocol="JsonPost"
encoding="utf-8"
>
<parameter name="text" type="System.String" layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff}: ${level} - ${message}"/>
</target>
它不会向我为 webhook 创建的松弛通道发布任何内容,而我看到我的 Nlog.config 中的其他目标被调用并且日志文件中填充了新数据。
知道我应该在哪里进行整理吗?
【问题讨论】:
-
检查内部日志是否有错误:github.com/NLog/NLog/wiki/Internal-logging
标签: json web-services nlog slack