<target name="asyncAsb" xsi:type="AsyncWrapper">
<target
name="asb"
type="AzureServiceBus"
connectionString="xxx"
queue="logs_queue" />
</target>
尝试通过json这样设置
"asyncAsb": {
"type": "AsyncWrapper",
"targets": {
"asb": {
"type": "AzureServiceBus",
"connectionString": "xxx",
"queue": "monitor_queue"
}
}
},
但出现错误 “未指定'AsyncWrapper TargetasyncAsb'上的必需参数'WrappedTarget'。”
有人有本节的例子吗?
答案 0 :(得分:3)
我想我们正在谈论https://github.com/NLog/NLog.Extensions.Logging项目,该项目允许使用JSON appsettings.json配置文件配置NLog。
从他们的示例https://github.com/NLog/NLog.Extensions.Logging/blob/master/examples/NetCore2/ConsoleExample/appsettings.json中,您可以看到针对您的情况的以下语法:
"targets": {
"asyncAsb": {
"type": "AsyncWrapper",
"target": {
"asb": {
"type": "AzureServiceBus",
"connectionString": "xxx",
"queue": "monitor_queue"
}
}
}
}