Nullreference exception
See original GitHub issueHeeey while moving our logging to the cloud we jumped upon an error:
2018-12-04 15:28:57.4550 Error Error while sending log messages to elasticsearch: message="Object reference not set to an instance of an object."
InternalsLog.txt
Our nlog.config looks like this
<?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"
autoReload="true"
internalLogLevel="Debug"
internalLogToConsoleError="true">
<extensions>
<add assembly="NLog.Targets.ElasticSearch"/>
</extensions>
<targets>
<target name="ElasticWrapper" xsi:type="BufferingWrapper" bufferSize="2000" flushTimeout="30000">
<target name="Elastic" xsi:type="ElasticSearch" index="index-${date:format=yyyy.MM.dd}" uri="https://uri.io:9243" requireAuth="true" username="user" password="password">
<field name="app" layout="${event-properties:item=app}" />
<field name="contextId" layout="${event-properties:item=contextId}" />
<field name="scope" layout="${event-properties:item=scope}" />
<field name="origin" layout="${event-properties:item=origin}" />
<field name="message" layout="${event-properties:item=message}" />
<field name="stacktrace" layout="${event-properties:item=stacktrace}" />
</target>
</target>
<target name="Console" xsi:type="Console" layout="${longdate} ${callsite} ${level} ${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="Console" />
<logger name="*" minlevel="Debug" writeTo="ElasticWrapper" />
</rules>
</nlog>
My guess is and as shown by fiddler is that there are two requests fired (localhost). First one goes to /
and then after a 200 OK do a request to /_bulk
posting the logs.
Within our cloud we use the users and get a 403 upon the first call to /
and therefore blocking other requests namely the /_bulk
call to actually post the results…
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
NullReferenceException Class (System)
A NullReferenceException exception is thrown by a method that is passed null . Some methods validate the arguments that are passed to them....
Read more >c# - What is a NullReferenceException, and how do I fix it?
The runtime throwing a NullReferenceException always means the same thing: you are trying to use a reference, and the reference is not ...
Read more >What is a Null Reference Exception?
A NullReferenceException happens when you try to access a reference variable that isn't referencing any object. If a reference variable ...
Read more >The Dreaded Null Reference Exception - Code Like A Girl
Null reference exceptions happen because of an error a developer has made. The developer tried to reference or use something that is set...
Read more >Fix Null Reference Exception in Unity - YouTube
Here I have another debugging tutorial on how to fix a NullReferenceException error in Unity. This lesson will teach you more about ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Created #76 that adds support for setting DisablePing on the NLog target.
Looks like you are missing this fix: https://github.com/elastic/elasticsearch-net/pull/3101
Try upgrading to https://www.nuget.org/packages/Elasticsearch.Net/6.1.0 (or newer)