serilog-contrib/serilog-sinks-azuretablestorage

DateTime values smaller than 1-1-1601 fails

siewers opened this issue · 1 comments

The minimum supported DateTime value for table storage is 1-1-1601 as described here https://docs.microsoft.com/en-us/rest/api/storageservices/Understanding-the-Table-Service-Data-Model?redirectedfrom=MSDN#property-types
This means that whenever a log entry contains a DateTime with a value less than that, the logging fails.
There doesn't seem to be any way to fix this through configuration, since the DateTime is treated as a scalar, and not properly handled in the implementation.

Is there something I'm missing or is this a bug?

I would expect some sort of DateTimeHandling configuration options somewhere, where you could either specify an object to handle unsupported DateTime values, or a simple option to be TreatAsNull or UseMinimumSupportedValue.

Not sure why there would ever be a DateTime that small. In version 8, you can completely customize the document created if you need to by implementing IDocumentFactory. Please open a new issue if this is still an issue. Thanks