0

I have tried so many things to do this and nothing works, but when I run my Azure function I get all these logs its far too much noise

What is the correct way to get rid of them once and for all?

I have this in my host.json

 "logging": {
    "logLevel": {
      "default": "Information",
      "Microsoft": "Warning",
      "System": "Warning",
      "Host": "Error",
      "Function": "Error",
      "Host.Aggregator": "Information"
    },
    "Serilog": {
      "MinimumLevel": "Information",
      "WriteTo": [
        {
          "Name": "Console",
          "Args": {
            "outputTemplate": "{Timestamp:HH:mm:ss} {Level} | {RequestId} - {Message}{NewLine}{Exception}"
          }
        }
      ]
    }
  },

and this is in my localsettings.json

  "logging": {
    "logLevel": {
      "Microsoft.Azure.WebJobs.Script.WebHost.Middleware.SystemTraceMiddleware": "Error",
      "Worker.rpcWorkerProcess": "Error"
    }
  },

enter image description here

Paul
  • 2,773
  • 7
  • 41
  • 96

1 Answers1

0

You have to modify the host.json for configuring minimum level of logs either locally or in Azure Cloud.
I can see you have defined the log values as Information, Warning to the Log Level attributes where information gives the general flow of the Application Execution from Start to End like Host level flow, Application-Level Flow logs.

Host.Aggregator generates more than the trace level metrics if assigned with the value of Information.

You have to remove/disable the unnecessary modules which are not required for logs or keep that modules log level to None if not required for the current situation and change the log level to minimum which also reduces your Logs Consumption if deployed to Azure Cloud.

I found a similar SO Issue 70690850 that shows the minimum log levels should be modified in the host.json which reduces the number of logs both locally and given the techniques of Application Insights and this MS Doc for more information on Log Levels Configuration.

Swarna Anipindi
  • 792
  • 2
  • 9