Error handling when used in an API #299
Description
A few questions before you begin:
Is this an issue related to the Serilog core project or one of the sinks or
community projects.
This issue list is intended for Serilog Elasticsearch Sink issues. If this issue relates to another sink or to the code project,
please log on the related repository. Please use Gitter chat and Stack Overflow for discussions and questons.
Does this issue relate to a new feature or an existing bug?
- Bug
- New Feature
What version of Serilog.Sinks.Elasticsearch is affected? Please list the related NuGet package.
Serilog.Sinks.Elasticsearch 8.0.1
What is the target framework and operating system? See target frameworks & net standard matrix.
- netCore 2.0
- netCore 1.0
- 4.7
- 4.6.x
- 4.5.x
Please describe the current behavior?
Is there a way to get errors out of the serilog.sinks.elasticsearch module when used in an API?
Inside my appsettings.json I have the following configured.
"Name": "Elasticsearch",
"Args": {
"nodeUris": "http://api.myco.com:9200/apidev/_doc",
"indexFormat": "custom-index-{0:yyyy.MM}",
"connectionGlobalHeaders": "Authorization=Basic TWxhc3RpYzpmUDcyVXJ0bjhUZ3lLbmcz",
"connectionTimeout": 5,
"emitEventFailure": "ThrowException",
"bufferBaseFilename": "logs/serilog-web-buffer",
"bufferFileSizeLimitBytes": 5242880,
"bufferLogShippingInterval": 5000,
"bufferRetainedInvalidPayloadsLimitBytes": 5000,
"bufferFileCountLimit": 31,
"deadLetterIndexName": "deadletter-{0:yyyy.MM}"
}
When I'm not connected to the network or elasticsearch is rejecting my log messages due to incompatible index, I expect to get an error somewhere.
I have tried all the options
WriteToSelfLog
WriteToFailureSink
ThrowException
RaiseCallback
I have yet to receive any error message indicating anything is wrong.
Also, the WriteToFailureSink option does not make sense to me as it is defined like this.
"failureSink": "My.Namespace.MyFailureSink, My.Assembly.Name"
But I haven't found any documentation on what that is expecting, or how to write it to a file.
Any help would be greatly appreciated.
Please describe the expected behavior?
Failures to log to ElasticSearch in an API would send a notification somewhere that something is wrong.
If the current behavior is a bug, please provide the steps to reproduce the issue and if possible a minimal demo of the problem