Janet Carson
11/14/2025, 4:38 PMMarvin
11/14/2025, 4:38 PMMarvin
11/14/2025, 4:45 PMfrom prefect import flow
@flow
def my_flow(): ...
my_flow.deploy(
name="prod",
work_pool_name="process-pool",
job_variables={
"env": {
"PREFECT_LOGGING_EXTRA_LOGGERS": "boto3,botocore,urllib3",
}
},
)
- In prefect.yaml:
deployments:
- name: prod
entrypoint: flows/my_flow.py:my_flow
work_pool:
name: process-pool
job_variables:
env:
PREFECT_LOGGING_EXTRA_LOGGERS: "boto3,botocore,urllib3"
2) At the work-pool template (applies to all deployments using that pool)
- Put the env in the pool’s base job template (for process workers, the env field). This is useful if you want the same setting everywhere. See “Customize job variables” docs below.
3) On the worker host (quick and simple, inherited by flow runs)
- In the script/service that starts your worker:
export PREFECT_API_KEY=*** # service account
export PREFECT_LOGGING_EXTRA_LOGGERS="boto3,botocore,urllib3"
prefect worker start -p process-pool
This will typically be inherited by the flow run subprocess. Using job_variables (options 1 or 2) is more explicit and survives worker restarts or different machines.
Related settings you might care about:
- PREFECT_LOGGING_LEVEL
- PREFECT_LOGGING_LOG_PRINTS
- PREFECT_LOGGING_TO_API_ENABLED (defaults to true; logs will go to the API)
Docs for deeper reference:
- Logging customization
- Settings and profiles (precedence)
- Customize job variables
- Process worker API reference
If you share how you’re managing deployments (prefect.yaml vs Python deploy()), I can give the exact snippet you need.