简体   繁体   中英

MongoDb target for NLog

I want to use NLog and MongoDb to logging. It isn't working. I have never used mongoDb and Nlog.

I got this warning :

This is an invalid xsi:type "http://www.nlog-project.org/schemas/NLog.xsd:Mongo"

How can i fix?

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 "

You could ignore this warning. The XSD contains all the names of the targets, but only the targets that aren't non-3rd party.

To check the error, enable and check the internal log of NLog

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM