quervernetzt
quervernetzt

Reputation: 11681

Azure Functions v2: logging customization in host.json

I would like to adjust the logging behavior of an Azure Functions app (v2, .NET Core). Therefore I adjusted the host.json as follows:

"logging": {
    "fileLoggingMode": "debugOnly",
    "logLevel": {
        "default": "None",
        "Host.Results": "Information",
        "Function": "Information",
        "Host.Aggregator": "Information"
    },
    "applicationInsights": {
        "samplingSettings": {
            "isEnabled": false,
            "maxTelemetryItemsPerSecond": 5
        }
    }
}

Two questions in that context:

Since I did that I see no new logs in Application Insights. Why?

Furthermore what does fileLoggingMode and its possible values never, always and debugOnly stand for? I haven't found a good explanation for that.

Thanks

Upvotes: 2

Views: 4961

Answers (1)

HariHaran
HariHaran

Reputation: 4199

I see no new logs in Application Insights. Why?

Since your log level is set to Information, are you doing Log.LogInformation() from your code ? If you are using Log.LogDebug() try changing it. More information about Log Filtering -> Docs

what does fileLoggingMode and its possible values never, always and debugOnly stand for?

By default the fileLoggingMode is set to debugOnly. Which means its helpful only when the function is published in Azure. If you want to see diagnostic logs for your function when running locally, you need to set it to always

Upvotes: 2

Related Questions