Azure functions log messages in debug

Viewed 413

I am now receiving a flurry of log messages in my console window while I'm debugging a function app locally.

It looks like this:

[2020-10-04T20:48:31.130] corehub-control-03: Lease renewal with token 23fb44c2-49e4-4e1f-9ff4-058612d66f1e succeeded
[2020-10-04T20:48:31.134] corehub-control-01: Lease renewal with token 6260dfd6-4f26-4c28-8104-d9aeb4e027a1 succeeded
[2020-10-04T20:48:31.317] corehub-control-02: Lease renewal with token f5d0840f-c96b-4931-91ac-657a9ebf6c2e succeeded
[2020-10-04T20:48:32.309] corehub-control-00: Lease renewal with token fa3a4e6a-9d0b-4c70-8613-b95e069dc1f0 failed
[2020-10-04T20:48:32.316] corehub-control-00: Lease renewal with token fa3a4e6a-9d0b-4c70-8613-b95e069dc1f0 failed: Exception of type 'DurableTask.AzureStorage.Partitioning.LeaseLostException' was thrown.
[2020-10-04T20:48:32.328] corehub-control-00: SOLO is no longer processing messages for this partition
[2020-10-04T20:48:32.341] corehub-control-00: Stopped listening for messages on queue corehub-control-00.
[2020-10-04T20:48:32.351] corehub-control-00: Successfully acquired lease
[2020-10-04T20:48:32.371] corehub-control-01: Attempting to acquire lease
[2020-10-04T20:48:32.513] corehub-control-01: Successfully acquired lease
[2020-10-04T20:48:32.518] corehub-control-02: Attempting to acquire lease
[2020-10-04T20:48:32.641] corehub-control-02: Successfully acquired lease
[2020-10-04T20:48:32.647] corehub-control-03: Attempting to acquire lease
[2020-10-04T20:48:32.771] corehub-control-03: Successfully acquired lease

The fails and errors are fine, but the lease acquisition and renewal messages seem pretty noisy. I have trouble reading my own debug messages in the noise and it keeps on scrolling as the app continues to run.

Is there any way to shut these off? I've tried a number of the settings but it still seems pretty chatty.

TIA

1 Answers

You can add section in host.json to filter the log.

For example, if you want to only see the error, your host.json should be like this:

{
    "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingExcludedTypes": "Request",
      "samplingSettings": {
        "isEnabled": true
      }
    },
    "logLevel": {
      "Function": "Error",
    }
  }
}

Check the filter and the level of the log of the funtion app:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-monitoring?tabs=cmd#log-levels

Related