artdolya/Nlog.RabbitMQ

Please fix internal error when connection is shutdown

Closed this issue · 2 comments

I see these messages when connection is shutdown:

2023-07-12 07:39:14.7786 Warn RabbitMQTarget(Name=logstash_wrapped): Starting connection-task timed out, continuing                                                                                    
 2023-07-12 07:39:14.7810 Warn RabbitMQTarget(Name=logstash_wrapped): Exception in Write Exception: System.NullReferenceException: Object reference not set to an instance of an object.                │
    at Nlog.RabbitMQ.Target.RabbitMQTarget.GetBasicProperties(LogEventInfo logEvent, IModel model)                                                                                                      
    at Nlog.RabbitMQ.Target.RabbitMQTarget.Write(LogEventInfo logEvent)                                                                                                                                 
    at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)

Would it be possible to check for nullness to avoid this internal exception?

Created #65

Nlog.RabbitMQ.Target ver. 2.11.17 has been released.