I'm currently in the process of testing custom logging for an Azure Function (function trigger) within a .NET 8 isolated environment. While I can see the logs being printed on the debug terminal, regrettably, they're not showing up in the Azure Portal's Application Insights. I've taken care to confirm that the instrumentation key is accurately configured in the local.settings.json file. Additionally, I've attempted solutions such as adding log levels in the host.json file, but the issue persists.
using Microsoft.ApplicationInsights.Channel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;
namespace Company.Function
public class TestFunctionPOC
{
private readonly ILogger<TestFunctionPOC> _logger;
public TestFunctionPOC(ILogger<TestFunctionPOC> logger)
{
_logger = logger;
}
[Function("TestFunctionPOC")]
public IActionResult Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")] HttpRequest req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
_logger.LogWarning("## this is a sample warning ##");
_logger.LogTrace("## This is a sample Trace #$#");
return new OkObjectResult("Welcome to Azure Functions!");
}
}
}

I have discovered the solution. By default, Application Insights only prints logs that are more severe, such as warnings. Therefore, we need to modify the default rule to include other log levels.
See microsoft docs for above here
And this solved my issue for azure functions in .net 8 isolated