Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Function-App is not logging to console or AppInsights

I have an Azure Function with AzureFunctionVersion v3 and for some time now I don't see any logs in Application Insights or in the Rider Console that are not logged in the FunctionTrigger itself.


[FunctionName("test")]
public IActionResult Test([HttpTrigger(AuthorizationLevel.Function, "delete", Route = BasePath + "/{roomId}")] HttpRequest req,
            ILogger log)
{
   log.LogInformation("Log is shown");

   myservice.DoIt();
}
namespace MyApp.Test.Service {
   public MyService(ILoggerFactory loggerFactory)
   {       
     _log = loggerFactory.CreateLogger(GetType().Namespace);
   }

   public void DoIt() {
      _log.LogInformation("Log is not shown");
   }
}

My host.json looks like:

"logging": {
        "applicationInsights": {
            "samplingExcludedTypes": "Request",
            "samplingSettings": {
                "isEnabled": false
            }
        },
        "logLevel": {
            "MyApp.*": "Information"
        }
    }
like image 276
barracuda317 Avatar asked Feb 03 '26 01:02

barracuda317


1 Answers

Please try to change the logLevel in one of the following ways:

  1. "logLevel": {"MyApp": "Information"}

  2. "logLevel": { "Default": "Information" }

like image 188
Ivan Yang Avatar answered Feb 04 '26 15:02

Ivan Yang