barracuda317
barracuda317

Reputation: 638

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"
        }
    }

Upvotes: 3

Views: 2196

Answers (1)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29940

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

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

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

Upvotes: 6

Related Questions