<@ULVA73B9P> how to put get_run_logger() in debug ...
# ask-marvin
l
@Marvin how to put get_run_logger() in debug mode ?
m
thought for 62.1 seconds
There are two main ways to enable debug logging for `get_run_logger()`: 1. Using environment variables (simplest method):
Copy code
bash
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:
Copy code
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.