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
What version of .NET does your existing project use?
.NET 6
What version of .NET are you attempting to target?
.NET 8
Description
Hello!
I managed successfully to migrate a .NET 6 In-Process Azure Function to .NET 8 isolated but I'm having issues configuring correctly Application Insights logs.
Currently the HostBuilder is configured in this way:
The logging.AddConfiguration(context.Configuration.GetSection("Logging")); intention from that line was to register in the logging configuration what I have configured in the host.json in combination with the AddJsonFile call.
Additionally, I added the removal of the default Filter which prevents to log any other LogLevel instead of Warning and higher.
If I debug the Program.cs with that setup, I see how the only existing rules are the ones created based on the host.json configuration:
If I change the parameter "AzureFunctionsJobHost__logging__logLevel__Function__ProcessRisk__User" value directly on Azure to Information I'm still only seeing the Logs attached on the image (Warning, Error & Critical) so i'm not able to increase o decrease the LogLevel.
Previously, I only added the script to remove the default rule on the Program.cs but only with that configuration the Function is always registering the Information Logs I wrote in the Function even if I have the LogLevel ("AzureFunctionsJobHost__logging__logLevel__Function__ProcessRisk__User") set to Error on Azure. That's why I tried to add the ConfigureLogging by taking values from the host.json file but is not working fine.
What is the correct configuration to be able to configure LogLevels based on Azure Environment variables?
What version of .NET does your existing project use?
.NET 6
What version of .NET are you attempting to target?
.NET 8
Description
Hello!
I managed successfully to migrate a .NET 6 In-Process Azure Function to .NET 8 isolated but I'm having issues configuring correctly Application Insights logs.
Currently the HostBuilder is configured in this way:
The
logging.AddConfiguration(context.Configuration.GetSection("Logging"));
intention from that line was to register in the logging configuration what I have configured in the host.json in combination with the AddJsonFile call.Additionally, I added the removal of the default Filter which prevents to log any other LogLevel instead of Warning and higher.
If I debug the Program.cs with that setup, I see how the only existing rules are the ones created based on the host.json configuration:
csproj looks like this:
The code Function:
the host.json
And the result Logs on the App Insights:
If I change the parameter "AzureFunctionsJobHost__logging__logLevel__Function__ProcessRisk__User" value directly on Azure to Information I'm still only seeing the Logs attached on the image (Warning, Error & Critical) so i'm not able to increase o decrease the LogLevel.
Previously, I only added the script to remove the default rule on the Program.cs but only with that configuration the Function is always registering the Information Logs I wrote in the Function even if I have the LogLevel ("AzureFunctionsJobHost__logging__logLevel__Function__ProcessRisk__User") set to Error on Azure. That's why I tried to add the ConfigureLogging by taking values from the host.json file but is not working fine.
What is the correct configuration to be able to configure LogLevels based on Azure Environment variables?
References I used:
Thanks.
Project configuration and dependencies
No response
Link to a repository that reproduces the issue
No response
The text was updated successfully, but these errors were encountered: