lucian
07/02/2025, 4:33 PMMarvin
07/02/2025, 4:33 PMMarvin
07/02/2025, 4:34 PMbash
export PREFECT_LOGGING_LEVEL="DEBUG"
# or more specifically for the root logger
export PREFECT_LOGGING_ROOT_LEVEL="DEBUG"
2. In your Python code, you can set the logger level directly:
python
from prefect import get_run_logger
from prefect.flows import flow
@flow
async def my_flow():
logger = get_run_logger()
logger.setLevel("DEBUG")
logger.debug("This debug message will now be visible")
The first method (environment variable) is generally preferred as it applies globally and doesn't require code changes. You'll see much more detailed logging output, including internal Prefect operations that might be helpful for debugging.
If you want to persist this setting, you can also modify your Prefect logging configuration file (typically at ~/.prefect/logging.yml
), but the environment variable approach is usually simpler.
Remember that debug logging can be quite verbose, so it's best to enable it only when you need detailed information for troubleshooting.