markmcdowell / NLog.Targets.ElasticSearch

NLog target for Elasticsearch
MIT License
176 stars 89 forks source link

Exceptions with properties that throw an exception when fetched fail to log #106

Closed samcook closed 5 years ago

samcook commented 5 years ago

Hi,

We've come across an issue with the ElasticSearch target where, if we attempt to log an entry with an exception attached, and that exception has a property that can't be fetched due to throwing an exception, that causes the log message (or in fact an entire batch of log messages, if buffering is involved) to be lost.

This PR contains a change that means that properties causing errors while serializing are skipped instead of throwing an exception, and instead a warning is logged to the NLog internal log. It also avoids doing exception serialization at all if there is a custom field configured for exceptions.

samcook commented 5 years ago

Thanks for merging this in. Are there plans to release a new package soon?

markmcdowell commented 5 years ago

Yeah I've published a new version, the build server seems to have picked 7.0.10 instead of 7.0.1 though...

markmcdowell commented 5 years ago

I've deployed a new version as 7.1.0