I recently upgraded our Azure Functions app from .NET 6 to .NET 8. Some strange behavior is occuring where I’m unable to see Information (or below) level logs. The settings pertaining to logs are the same.
Code:
<code>Logger?.LogError("Test if we can log error");
Logger?.LogWarning("Test if we can log warning");
Logger?.LogInformation("Test if we can log info");
Logger?.LogDebug("Test if we can log debug");
</code>
<code>Logger?.LogError("Test if we can log error");
Logger?.LogWarning("Test if we can log warning");
Logger?.LogInformation("Test if we can log info");
Logger?.LogDebug("Test if we can log debug");
</code>
Logger?.LogError("Test if we can log error");
Logger?.LogWarning("Test if we can log warning");
Logger?.LogInformation("Test if we can log info");
Logger?.LogDebug("Test if we can log debug");
Logs:
<code>[2024-05-30T10:24:45.823Z] Test if we can log error
[2024-05-30T10:24:45.824Z] Test if we can log warning
.. that's it
</code>
<code>[2024-05-30T10:24:45.823Z] Test if we can log error
[2024-05-30T10:24:45.824Z] Test if we can log warning
.. that's it
</code>
[2024-05-30T10:24:45.823Z] Test if we can log error
[2024-05-30T10:24:45.824Z] Test if we can log warning
.. that's it
Logging obviously works because I can see Error and Warning log levels. My host.json
:
<code>{
"version": "2.0",
"logging": {
"logLevel": {
"AlarmFunctions.Functions": "Debug",
"DataLayer": "Debug",
"ServiceLayer": "Debug",
"Function": "Warning",
"default": "Warning"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Trace;Request"
},
"LogLevel": {
"Default": "Warning"
}
}
},
"extensions": {
"serviceBus": {
"maxMessageBatchSize": 5
},
"durableTask": {
"storageProvider": {
"maxQueuePollingInterval": "00:00:01"
}
}
}
}
</code>
<code>{
"version": "2.0",
"logging": {
"logLevel": {
"AlarmFunctions.Functions": "Debug",
"DataLayer": "Debug",
"ServiceLayer": "Debug",
"Function": "Warning",
"default": "Warning"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Trace;Request"
},
"LogLevel": {
"Default": "Warning"
}
}
},
"extensions": {
"serviceBus": {
"maxMessageBatchSize": 5
},
"durableTask": {
"storageProvider": {
"maxQueuePollingInterval": "00:00:01"
}
}
}
}
</code>
{
"version": "2.0",
"logging": {
"logLevel": {
"AlarmFunctions.Functions": "Debug",
"DataLayer": "Debug",
"ServiceLayer": "Debug",
"Function": "Warning",
"default": "Warning"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Trace;Request"
},
"LogLevel": {
"Default": "Warning"
}
}
},
"extensions": {
"serviceBus": {
"maxMessageBatchSize": 5
},
"durableTask": {
"storageProvider": {
"maxQueuePollingInterval": "00:00:01"
}
}
}
}
Important to note is that logLevel
in host.json
does not apply anymore. Above provided logging code is located in namespace AlarmFunctions.Functions.SomeClassName
but changing loglevel to "AlarmFunctions.Functions": "Error"
still makes the warning log show up.
Am i missing something?
Thanks