Reputation: 11
We have a system running in an Azure App service and we like to do some diagnostics logging in it.
As we understand it you set the "Application Logging (Filesystem)" setting to "On" and the appropriate level (like "Information"). This setting is found on the "App service logs" page in Azure.
Then you call a trace function, like: System.Diagnostics.Trace.TraceInformation("My message")
in the code.
Then the log entry is supposed to end up in one of the files in the LogFiles/Application directory in the App service.
When we check in Kudu>Debug console>cmd it does not show up though. Things are logged there but none of our logs.
If we debug the service, running it locally and using Visual Studio to debug, our logs appear in the Visual Studio debug-window.
Any ideas what may be the reason for this behavior? How can we make it work?
Upvotes: 0
Views: 288
Reputation: 3183
I just tried the same steps and it displays the logs fine:
Kindly check to see if App Service diagnostics provides any pointers, it reduces the chance of trial and error and expedites problem resolution by recommending potential solutions. To access App Service diagnostics, navigate to your App Service app in the Azure portal. In the left navigation, click on Diagnose and solve problems
Also, just to isolate, you could review the Service Health notifications for any pointers:
The ‘Service Health’ - Service issues view shows any ongoing problems in Azure services that are impacting your resources. You can understand when the issue began, and what services and regions are impacted. You can also read the most recent update to understand what Azure is doing to resolve the issue. See, Azure Service Health -https://learn.microsoft.com/en-us/azure/service-health/service-health-overview
I understand the logging works fine locally, just review the code sample below to have a similar lines and see if that helps:
< System.Diagnostics.Trace.WriteLine("System.Diagnostics.Trace.WriteLine() in the Page_Load method");
Trace.Write("Trace.Write() in the Page_Load method");
System.Diagnostics.Trace.TraceError("System.Diagnostics.Trace.TraceError() in the Page_Load method");
System.Diagnostics.Trace.TraceWarning("System.Diagnostics.Trace.TraceWarning() in the Page_Load method");
System.Diagnostics.Trace .TraceInformation("System.Diagnostics.Trace.TraceInformation() in the Page_Load method");
> Sample as mentioned in this blog
Upvotes: 0