【发布时间】:2018-12-17 02:09:46
【问题描述】:
我正在使用 Nlog 并尝试将其发布到 CosmosDB(DocumentDB) 目标 使用https://www.nuget.org/packages/Nlog.DocumentDBTarget/
我的配置代码是这样的
var documentDBTarget = new DocumentDBTarget()
{
Name = "logDocument",
EndPoint = "https://[my endpoint].documents.azure.com:443/",
AuthorizationKey = "[my auth key]",
Collection = "[my collection]",
Database = "[my database]",
Layout=jsonLayout
};
config.AddTarget(documentDBTarget);
config.AddRuleForAllLevels(documentDBTarget);
我已经声明了 jsonLayout,然后我配置了记录器并使用它来开始记录。当我登录到本地文件目标或控制台目标时,这工作正常,但它不适用于 cosmosDB
LogManager.Configuration =config;
Logger logger = LogManager.GetLogger("Example");
logger.Info("{object}");
我错过了什么? https://github.com/goto10hq/NLog.DocumentDB?files=1 的文档 我没有找到任何关于使用 Nlog 发帖的信息我只找到了关于配置它的信息,我相信我做对了
谢谢
【问题讨论】:
标签: c# azure-cosmosdb nlog