我想使用 NLog 和 MongoDb 进行日志记录。它不工作。我从未使用过 mongoDb 和 Nlog。
我收到了这个警告:
This is an invalid xsi:type "http://www.nlog-project.org/schemas/NLog.xsd:Mongo"
我该如何解决?
NLog.config :
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<extensions>
<add assembly="NLog.Mongo"/>
</extensions>
<targets>
<target xsi:type="Database"
name="mongoCustom"
includeDefaults="false"
connectionString="mongodb://localhost"
collectionName="book"
databaseName="store"
cappedCollectionSize="26214400">
<property name="Date" layout="${date}" bsonType="DateTime" />
<property name="Message" layout="${message}"/>
<property name="Code" layout="${var:logCode}"/>
</target>
</targets>
最佳答案
This is an invalid xsi:type "http://www.nlog-project.org/schemas/NLog.xsd:Mongo"
您可以忽略此警告。 XSD 包含目标的所有名称,但仅包含非第 3 方的目标。
关于c# - NLog 的 MongoDb 目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51728268/