I am using the same log settings on my dev system and on Azure. Both use appsettings.json. I have no Logger settings in appsettings.Development.json or secrets.json on my dev system. I have none in the Environment Variables on Azure.
My logs on my dev system show LogTrace() (where specified). But on Azure it does not. It has DEBUG, but not TRACE.
Is there some override I need to set in Azure to allow Trace logging?
This is not for the app service logs in Azure, it is for an ILoggerProvider I have written myself.
I'm using the following code to implement a custom ILogger in an ASP .NET Core 6 web application.
To observe logs in Azure, I added the following code to the Program.cs file.
program.cs:
I added the following NuGet package to the .csproj file.
.csproj:
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="8.0.2" />This is my customLogger class.
CustomLogger.cs:
CustomLoggerProvider.cs:
HomeController.cs:
appsettings.json::
appsettings.Development.json:
This is my local console Log trace:
After publishing the web app to Azure App Service, navigate to Monitoring -> App Service Logs, and turn on Application Logging (Filesystem) and set Level to Verbose as shown below.
I was also able to see the logs in the Log Stream in the Azure Web App, as shown below.
Azure App service Output: