Detail logging running on Console vs running in Azure Function

I am using Confluent.Kafka NuGet v 2.1 package with Visual Studio 2022 with .NET 8.

I have simple code to consume data from Kafka and when I run in a Console OR with an Azure Function locally on my machine, I can see all the detailed Kafka information as seen below. The Debug property of the ConsumerConfig is consumer,topic

[2025-04-30T15:22:18.803Z] %7|1746026538.802|INIT|rdkafka#consumer-1| [thrd:app]: librdkafka v2.10.0 (0x20a00ff) rdkafka#consumer-1 initialized (builtin.features gzip,snappy,ssl,sasl,regex,lz4,sasl_gssapi,sasl_plain,sasl_scram,plugins,zstd,sasl_oauthbearer,http,oidc, SSL ZLIB SNAPPY ZSTD CURL SASL_SCRAM SASL_OAUTHBEARER PLUGINS HDRHISTOGRAM, debug 0x2004)
[2025-04-30T15:22:18.813Z] %7|1746026538.812|SUBSCRIBE|rdkafka#consumer-1| [thrd:main]: Group “neo.qua.382c5bb2-1dc4-4771-8304-c5d3b1aa7fe1”: subscribe to new subscription of 1 topics (join-state init)
[2025-04-30T15:22:28.822Z] %7|1746026548.822|DESTROY|rdkafka#consumer-1| [thrd:app]: Terminating instance (destroy flags NoConsumerClose (0x8))
[2025-04-30T15:22:28.825Z] %7|1746026548.822|CLOSE|rdkafka#consumer-1| [thrd:app]: Closing consumer
[2025-04-30T15:22:28.826Z] %7|1746026548.822|CLOSE|rdkafka#consumer-1| [thrd:app]: Disabling and purging temporary queue to quench close events
[2025-04-30T15:22:28.827Z] %7|1746026548.822|CLOSE|rdkafka#consumer-1| [thrd:app]: Consumer closed

However, when I run the same code within Azure, I do not see those debug lines. It is like if the package Confluent.Kafka would only log those when a Console exist. There is no Console when running in Azure, there are loggers that allow to log information.

I would like to also see all those log details when running within an function in Azure.

Anyone can help with this?

What does the logging section of host.json look like? Have you turned on Application Insights? From here:

Locally, logs are printed to the console.

In Azure, query Application Insights traces to view the log messages.

The logging section looks like this:

“logging”: {
“applicationInsights”: {
“samplingSettings”: {
“isEnabled”: true,
“excludedTypes”: “Request”
},
“enableLiveMetricsFilters”: true
}
}

The Function App in Azure is connected to an Application Insight instance.

I have this also in Program.cs

// Application Insights isn’t enabled by default. See Guide for running C# Azure Functions in an isolated worker process | Microsoft Learn.
// builder.Services
// .AddApplicationInsightsTelemetryWorkerService()
// .ConfigureFunctionsApplicationInsights();