I've got a project that uses NLog. This is working great for logging to a local file, but when I try to have log messages target a WebServer, nothing seems to happen.
Relevant part of nlog.config:
<targets>
<target xsi:type="WebService" name="ws" url="http://localhost:8088/api" protocol="HttpPost" encoding="UTF-8" >
<parameter name="Message" type="System.String" layout="${message}" />
</target>
</targets>
<rules>
<logger name="QS.WebLogger" minLevel="Info" writeTo="ws" final="true" />
</rules>
And then within my code:
var loggerFactory = new LoggerFactory().AddNLog();
loggerFactory.ConfigureNLog("nlog.config");
var log = loggerFactory.CreateLogger<QS.WebLogger>();;
log.LogError("error message");
I've tried a handful of ways to call LogError but regardless of what I try, it goes into LogError without throwing an error, but I never see any attempt to actually call the web service in Fiddler. NLog does appear to understand that it should be logging to the web service, though, since it respects the final="true" and will not log those messages to other targets down the line.
I do get the following message in NLog's internal log: Warn Type load exception. Exception: System.TypeLoadException: Could not load type 'System.Web.IHttpModule' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. I believe this is due to the project being .NET Core, but would expect things to still work (otherwise would be an Error, not Warn).
The examples I can find use NLog's EventLogInfo, which I can't use because NLog is behind Microsoft's ILogger, which doesn't know what EventLogInfo is.
How do I get it to actually send a message instead of silently swallowing the log message?