saleem-mirza / serilog-sinks-azure-analytics

Serilog sink which writes to Azure analytics
Apache License 2.0
62 stars 45 forks source link

Bug Fixes and JSON Formatting #89

Closed msimmdev closed 7 months ago

msimmdev commented 8 months ago

In my attempts to get this working in my project I encountered a few problems. I've included my solutions here for consideration.

  1. My logs included the message template, but not the rendered message - To resolve I've added the rendered message to the payload send to LA
  2. I was unable to set configuration settings (initially found when trying to adjust the JSON Serializer) - I've passed on the configuration settings provided by the caller and only create a new one if none is provided by the calling code.
  3. The System.Text.JSON serializer was not able to serialize the Serilog.LogEventProperty objects meaning the log property values were missing from my logs. - I've added support for using one of the JSON Formatters (with the ITextFormatter interface) provided by Serilog to format the JSON sent to LA

Note that point 3 does significantly change the format of the event sent to LA, however I believe it was previously failing to send much of the information.