Eduardo Brito
12/15/2025, 1:02 PMMarvin
12/15/2025, 1:02 PMMarvin
12/15/2025, 1:11 PMPREFECT_LOGGING_LEVEL=DEBUG python your_flow.py
- Persistently (profile)
- Save to your active Prefect profile:
prefect config set logging.level=DEBUG
- Only bump flow/task loggers (keep everything else at INFO)
- Set just these:
export PREFECT_LOGGING_LOGGERS_PREFECT_FLOW_RUNS_LEVEL=DEBUG
export PREFECT_LOGGING_LOGGERS_PREFECT_TASK_RUNS_LEVEL=DEBUG
Notes
- Make sure the UI’s log level filter includes Debug.
- API logging is on by default, but if you’ve changed it, ensure:
PREFECT_LOGGING_TO_API_ENABLED=true
POC (copy/paste)
1) Local run POC (shows DEBUG in UI when enabled)
Save as flow_debug_poc.py:
from prefect import flow, task
from prefect.logging import get_run_logger
@task
def my_task():
logger = get_run_logger()
logger.debug("Task DEBUG appears when level=DEBUG")
<http://logger.info|logger.info>("Task INFO")
logger.warning("Task WARNING")
logger.error("Task ERROR")
logger.critical("Task CRITICAL")
@flow(name="debug-demo")
def debug_demo():
logger = get_run_logger()
logger.debug("Flow DEBUG appears when level=DEBUG")
<http://logger.info|logger.info>("Flow INFO")
logger.warning("Flow WARNING")
logger.error("Flow ERROR")
logger.critical("Flow CRITICAL")
my_task()
if __name__ == "__main__":
debug_demo()
Run it with DEBUG enabled:
PREFECT_LOGGING_LEVEL=DEBUG python flow_debug_poc.py
2) Deployment/worker POC (two ways)
Option A: Set DEBUG at the worker
- Create a process work pool (once):
prefect work-pool create "process-pool" --type process
- Start a worker with DEBUG in the environment:
PREFECT_LOGGING_LEVEL=DEBUG prefect worker start --pool process-pool
- Deploy the flow (from the same directory as flow_debug_poc.py):
python -c "from prefect.flows import Flow; Flow.from_source('.', 'flow_debug_poc.py:debug_demo').deploy(name='debug-demo', work_pool_name='process-pool')"
- Run the deployment:
prefect deployment run debug-demo --watch
Option B: Set DEBUG on the deployment (no special worker env needed)
- Deploy with an env override:
python -c "from prefect.flows import Flow; Flow.from_source('.', 'flow_debug_poc.py:debug_demo').deploy(name='debug-demo', work_pool_name='process-pool', job_variables={'env': {'PREFECT_LOGGING_LEVEL':'DEBUG'}})"
- Start a normal worker:
prefect worker start --pool process-pool
- Run the deployment:
prefect deployment run debug-demo --watch
If you still don’t see DEBUG logs:
- Double-check the UI filter for Debug
- Confirm the process actually has PREFECT_LOGGING_LEVEL=DEBUG
- For targeted control, try:
PREFECT_LOGGING_LOGGERS_PREFECT_FLOW_RUNS_LEVEL=DEBUG
PREFECT_LOGGING_LOGGERS_PREFECT_TASK_RUNS_LEVEL=DEBUGEduardo Brito
12/15/2025, 2:25 PM