Open AlexLexicon opened 1 year ago
Describe the bug The ConfigurationSettings.PropertyNamingStrategy does not work:
configuration .WriteTo.AzureAnalytics("...", "...", new ConfigurationSettings { LogName = "mylog", PropertyNamingStrategy = NamingStrategy.CamelCase }) .Enrich.FromLogContext();
this is because the JsonExtensions.LogPropertyName is hard coded as a constant in pascal case:
internal static class JsonExtensions { private const string LogPropertyName = "LogProperties"; ... }
So when the Flatten method is called:
internal static class JsonExtensions { internal static JObject Flatten(this JObject jsonObject, bool flatObject = true) { ... var logPropToken = jsonObject.GetValue(LogPropertyName); jsonObject.Remove(LogPropertyName); jsonObject.Add(LogPropertyName, logPropToken.ToString(Newtonsoft.Json.Formatting.None, null)); return jsonObject; } }
it will throw a NullReferenceException because "logPropToken" is null since it could not find that property.
To Reproduce Use the ConfigurationSettings.PropertyNamingStrategy set to camel case and make a log call.
Expected behavior The log should be produced with camel cased properties
Screenshots
PR: #76
Describe the bug The ConfigurationSettings.PropertyNamingStrategy does not work:
this is because the JsonExtensions.LogPropertyName is hard coded as a constant in pascal case:
So when the Flatten method is called:
it will throw a NullReferenceException because "logPropToken" is null since it could not find that property.
To Reproduce Use the ConfigurationSettings.PropertyNamingStrategy set to camel case and make a log call.
Expected behavior The log should be produced with camel cased properties
Screenshots