I have been trying to use NLog.Mongo and NLog.MongoDB to write logs to a Mongo database. However, I keep getting an error saying "This is an invalid xsi:type 'http://www.nlog-project.org/schemas/NLog.xsd:MongoDB". The code I am using is the following:
<?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.MongoDB"/>
</extensions>
<targets>
<target xsi:type="MongoDB" name="mongo" database="NLog">
<field name="timestamp" layout="${date}"/>
<field name="level" layout="${level}"/>
<field name="message" layout="${message}"/>
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="mongo"/>
</rules>
</nlog>
I am either looking for a solution to this error or another way this could be performed. I have searched everywhere I can think of and only found unanswered questions such as: