Uh oh!
There was an error while loading. Please reload this page.
Add caller-provided logger configuration - #252
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
There was a problem hiding this comment.
Pull request overview
This PR updates the Durable Task Python SDK and its Azure Managed / Azure Functions provider packages to let callers supply fully configured logging.Logger instances, and to ensure Azure Functions components emit logs through the host-managed azure.durable_functions.* logger hierarchy (rather than SDK-installed handlers).
Changes:
- Added an optional
loggerparameter to core and Azure Managed clients/workers, and ensured the SDK does not mutate caller-supplied logger configuration. - Deprecated
log_handler/log_formatter(with warnings) while preserving existing behavior when they’re used. - Added documentation and tests covering logger forwarding and Azure Functions host logging behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/durabletask/test_logging.py | New tests validating core components accept a caller-supplied logger unchanged and enforce incompatibility with legacy logging options. |
| tests/durabletask-azuremanaged/test_logging.py | New tests validating Azure Managed components forward a supplied logger unchanged. |
| tests/azure-functions-durable/test_logging.py | New tests validating Azure Functions components use the module logger (host-managed hierarchy). |
| durabletask/worker.py | Added logger parameter and updated worker documentation to deprecate legacy logging options. |
| durabletask/internal/shared.py | Extended get_logger() to accept a caller-supplied logger and emit deprecation warnings for legacy options. |
| durabletask/client.py | Added logger parameter to sync/async clients and forwarded it into shared logger creation. |
| durabletask-azuremanaged/durabletask/azuremanaged/worker.py | Added logger pass-through and updated Azure Managed worker docs for deprecation guidance. |
| durabletask-azuremanaged/durabletask/azuremanaged/client.py | Added logger pass-through to Azure Managed clients (sync + async). |
| durabletask-azuremanaged/CHANGELOG.md | Documented the new logger parameter and legacy option deprecations. |
| docs/features.md | Added SDK logging guidance, including propagation/handler duplication trade-offs. |
| CHANGELOG.md | Documented the new core logger parameter and legacy option deprecations. |
| azure-functions-durable/CHANGELOG.md | Documented that Functions logs now flow through the host-managed logger hierarchy. |
| azure-functions-durable/azure/durable_functions/worker.py | Introduced module logger and forwarded it into the base worker to avoid SDK-owned handlers. |
| azure-functions-durable/azure/durable_functions/client.py | Introduced module logger and forwarded it into the base clients to avoid SDK-owned handlers. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ce0bfcf6-4e74-4a28-b802-45c98f3af2ef
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
Bernd Verst (berndverst)
left a comment
There was a problem hiding this comment.
Two non-blocking correctness issues remain in deprecation attribution and sync-client fail-fast cleanup. Otherwise the API shape, wrapper forwarding, Functions host routing, performance characteristics, documentation/changelogs, and coverage look sound. Local targeted tests, affected flake8 checks, and strict Pyright checks passed; all checks on this head are green.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: d3b014e3-808e-455f-b932-01d0a7aa5c93
Why this is needed
Azure Functions 2.x clients and workers currently receive private core-SDK loggers with SDK-owned INFO stream handlers. Those records bypass the Azure Functions host logging pipeline, so host-level configuration cannot reliably control their level, routing, sampling, or telemetry correlation.
This change makes Functions-created components use the
azure.durable_functions.clientandazure.durable_functions.workermodule loggers. They have no SDK-installed handlers and propagate normally, so the Functions host owns logging behavior as it does for the v1 SDK.Changes
loggerto core and Azure Managed clients and workerslog_handlerandlog_formatterwhile preserving their existing behaviorValidation
python -m pytest tests\durabletask\test_logging.py tests\durabletask-azuremanaged\test_logging.pypython -m pytest tests\azure-functions-durable\test_logging.py tests\azure-functions-durable\test_client_lifecycle.py tests\azure-functions-durable\test_client_compat.py tests\azure-functions-durable\test_worker_compat.pypython -m flake8 durabletask tests\durabletaskpython -m flake8 durabletask-azuremanaged tests\durabletask-azuremanagedpython -m flake8 azure-functions-durable tests\azure-functions-durablepython -m pyright durabletask\client.py durabletask\worker.py durabletask\internal\shared.py durabletask-azuremanaged\durabletask\azuremanaged\client.py durabletask-azuremanaged\durabletask\azuremanaged\worker.pypython -m pymarkdown -c .pymarkdown.json scan docs\features.md