azureazure-web-app-serviceazure-application-insightstracelistener

How can I change the TraceLevel for an Azure App Service without redeploying it?


I am using Application Insights in an MVC 5 application that I deploy to an Azure App Service (formerly known as an "Azure Web Site"). I have Application Insights setup to be a Trace Listener. It all works well - I am using this method.

My next need is to be able to control the TraceLevel setting without redeploying the site. I am mostly likely going to keep it at Warning on a 24/7 basis but if something funny or interesting is happening, I'd like to drop it down to Info or Verbose. It is this specific changing of the setting that I'm asking about. So my questions:

  1. Is there a built-in way to change/toggle this without any downtime or deployments?
  2. Is there a best practice way to accomplish this regardless of what the answer is to the previous question? Really looking to avoid hiccups/downtime as I toggle this, although if I must suffer a hiccup then that will still be better than a redeployment.

Note: I'm tagging this with Application Insights but I don't think it really matters what my trace listeners are.


Solution

  • According to this page:

    https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-enable-diagnostic-log

    Unlike changing the web.config file, enabling Application diagnostics or changing diagnostic log levels does not recycle the app domain that the application runs within.