1

I'm curious if there's a way for overriding the loglevel of the azure function default or built-in logs.

I've attached a screenshot below with some examples of the unwanted logs.

screenshot of unwanted logs

I've found out that I can override the setting for my custom logs in app.settings by adding this: AzureFunctionsJobHost__logging__LogLevel__Default

Is there a way to differentiate my custom logs from the default logging?

Stop an Azure Function from logging the “Executing” and “Executed” messages

I went through this post, but I noticed people complaining about their custom information logs not being logged into app insights anymore.

Also, I've read some Microsoft documentation about a settings AzureWebJobsDashboard that you should delete if you want to disable built-in logging. However, I can't find this setting in the azure function app.settings.

I would highly appreciate if someone would clarify this topic for me, I'm kind of a junior with Azure. Also sorry if this post is spam.

Thank you for your time! :D

1 Answers1

1

Overriding the loglevel of the azure function default or built-in logs

Yes, we can override function log level after deployed into azure.

After deployed in azure if you want to override logging keep adding the AzureFunctionsJobHost__path__to__setting setting in Application Settings in function Configuration. If you added the settings in Application Settings it will override into host.json

AzureFunctionsJobHost__path__to__setting

I have added in my function and the local.settings.json. In Below default log level has information "default": "Information" changing to Debug using "AzureFunctionsJobHost__logging__logLevel__Default": "Debug". enter image description here

After deployment Use portal to override. enter image description here

Disable the Specific function logging:

In host.json while logging your function telemetry information we are using log levels and categories Ms-Doc. Use Log Level has None to disable the specified category log.

  "logLevel": {
      "default": "Information", 
      "Host.Results": "Error", // Host.Results will collect only Error
      "Function": "None", // Disable logging for the Function catagory
      "Host.Aggregator": "Trace"
    }
Delliganesh Sevanesan
  • 4,146
  • 1
  • 5
  • 15