Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure function app traces exhibiting strange behavior

I have 10+ azure function apps deployed. Out of them only one function app always writes a trace message "Executing HttpStatusCodeResult, setting HTTP status code 200" every 10 seconds. I can not find the source from where this log is coming. My host.json looks like below

{
  "version": "2.0",
  "logging": {
    "fileLoggingMode": "debugOnly",
    "LogLevel": {
      "Default": "Information"
    }
  },
  "extensions": {
    "http": { "routePrefix": "api" }
  }
}
like image 997
DevMJ Avatar asked Jul 03 '26 18:07

DevMJ


1 Answers

When you have some unwanted logs in application insights, click on it and see what's the category:

Trace

As you can see, the category is Microsoft.AspNetCore.Mvc.StatusCodeResult and the severity level is Information.

What I did was to ignore all the logs with lower level than Warning from all the categories starting with Microsoft. I configured it in the host.json file:

{
  "version": "2.0",
  "logging": {
    "fileLoggingMode": "always",
    "logLevel": {
      "default": "Information",
      "Host.Controllers.Host": "Warning",
      "Microsoft": "Warning"
    }
  }
}

As you can see, I also set Warning value to Host.Controllers.Host to avoid messages like Ping Status: { "hostState": "Running" }

like image 132
cryss Avatar answered Jul 06 '26 10:07

cryss



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!