You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a solution containing both ASP.NET Core minimal APIs and Azure Functions. My organization is attempting to create very uniform application start up processes, and thus we attempt to use this Serilog sink in the same manner in both the APIs and functions. We provide the configuration from JSON config providers using ReadFrom.Configuration().
For the Azure functions, we can omit the connection string property from the Serilog WriteTo section of the configuration file. We do provide APPLICATIONINSIGHTS_CONNECTION_STRING property in the config, which is working for both the sink and when registering the telemetry collection. No additional code is needed for the azure functions to properly log to App Insights.
For the APIs, providing APPLICATIONINSIGHTS_CONNECTION_STRING in the config works for registration, but does not work for the sink. We are having to add an additional step to save the value from the config into an environment variable. Since neither the builder.Services.AddApplicationInsightsTelemetry() or Azure function serilog set up require this step, this is inconsistent.
Wondering if support can be added for retrieving the connection string from IConfiguration["APPLICATIONINSIGHTS_CONNECTION_STRING"] if not present in environment variable or provided in config directly?
The text was updated successfully, but these errors were encountered:
Thanks for the write-up and suggestion. I'm not actively using this sink so something of a caretaker right now, and not sure what would be involved in implementing this. If you're keen to dig in further to figure out the impacts/possibly put together a PR, I can help to push it ahead.
Ok great, I am not sure when I will have availability to do that, but I am really interest in doing so, so I will do my best to work it in, and I will comment back here if/when I can do so. Thanks so much!
Hello,
I am working on a solution containing both ASP.NET Core minimal APIs and Azure Functions. My organization is attempting to create very uniform application start up processes, and thus we attempt to use this Serilog sink in the same manner in both the APIs and functions. We provide the configuration from JSON config providers using ReadFrom.Configuration().
For the Azure functions, we can omit the connection string property from the Serilog WriteTo section of the configuration file. We do provide APPLICATIONINSIGHTS_CONNECTION_STRING property in the config, which is working for both the sink and when registering the telemetry collection. No additional code is needed for the azure functions to properly log to App Insights.
For the APIs, providing APPLICATIONINSIGHTS_CONNECTION_STRING in the config works for registration, but does not work for the sink. We are having to add an additional step to save the value from the config into an environment variable. Since neither the builder.Services.AddApplicationInsightsTelemetry() or Azure function serilog set up require this step, this is inconsistent.
Wondering if support can be added for retrieving the connection string from IConfiguration["APPLICATIONINSIGHTS_CONNECTION_STRING"] if not present in environment variable or provided in config directly?
The text was updated successfully, but these errors were encountered: