Azure Functions Python: why are DEBUG and CRITICAL logs ingested as Informational in FunctionAppLogs?

Wessel Vonk 45 Reputation points
2026-07-15T13:56:49.8933333+00:00

I am seeing unexpected severity mapping for Python logs in Azure Functions.

In my Function App, INFO, WARNING, and ERROR are ingested correctly in Log Analytics. However, DEBUG logs are either missing or appear as Informational, and CRITICAL logs are ingested as Informational instead of Critical.

The Python LogRecord itself appears to be correct before emission: record.levelname + record.levelno is correct.

The issue seems to happen after the log is emitted.

Observed behavior:

INFO -> Informational
WARNING -> Warning
ERROR -> Error
CRITICAL -> Informational
DEBUG -> Informational

These logs are coming from an Azure Functions Python app and appear in the FunctionAppLogs table with category Host.Function.Console.

Q: Is this expected behavior for Python logging in Azure Functions, specifically for logs ingested through Host.Function.Console? Is there an official way to preserve DEBUG and CRITICAL as proper severity levels in Log Analytics?

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


1 answer

Sort by: Most helpful
  1. Christos Panagiotidis 801 Reputation points
    2026-07-16T07:16:21.38+00:00

    This is only partly expected. DEBUG being absent is normal with the default Functions configuration, but CRITICAL being downgraded to Information is not. The FunctionAppLogs schema explicitly supports Critical/LevelId 5; a host.json threshold can filter a record, but it should not change Critical into Information.

    Handle the two issues separately:

    1. To collect Python debug logs, set the app setting PYTHON_ENABLE_DEBUG_LOGGING=1 and set the relevant host.json log level to Debug or Trace. Also check whether an AzureFunctionsJobHost__logging__logLevel__... app setting overrides the deployed host.json.
    2. The category Host.Function.Console is an important clue. Confirm the application is using Python’s built-in root logging functions inside the invocation. Remove custom StreamHandler/stdout redirection and avoid print for records whose severity must be preserved; console capture can lose the original LogRecord metadata before the host creates the FunctionAppLogs row.
    3. After restarting, emit a minimal set of five test records and query Category, Level, LevelId, Message, HostVersion. With the supported worker path, Critical should be Level=Critical/LevelId=5.

    If Critical still arrives as LevelId 2, collect the Function host version, Python version, worker version, OS/plan, host.json, and a minimal reproducer, then open an Azure support case or a python-worker issue. That would be a runtime/ingestion defect, not an intentional severity mapping.

    References: Python logging in Azure Functions and the FunctionAppLogs column definitions.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.