question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nullreference exception

See original GitHub issue

Heeey 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:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
snakefootcommented, Dec 5, 2018

Created #76 that adds support for setting DisablePing on the NLog target.

1reaction
snakefootcommented, Dec 4, 2018
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found