Daniel Manson
02/17/2025, 5:06 PMfrom prefect.settings import PREFECT_LOGGING_LEVEL
import logging
print(f"{PREFECT_LOGGING_LEVEL} {logging.getLogger().level}")
# prints "30 INFO"
(note 30 is WARNING in python).
This didn't use to happen. what's up?Marvin
02/17/2025, 5:06 PMPREFECT_LOGGING_LEVEL
and the root Python logger's level is due to how Prefect and Python handle logging configurations. By default, the root Python logger is set to output logs at the WARNING
level (which corresponds to 30), while Prefect's default logging level is often set to INFO
.
Here's how you can understand and possibly resolve this:
1. Root Logger Configuration: The root Python logger's default level is WARNING
. This is independent of Prefect's logging level settings. You can override this using the PREFECT_LOGGING_ROOT_LEVEL
environment variable if needed.
2. Prefect's Logging Level: The PREFECT_LOGGING_LEVEL
setting controls logging specifically for Prefect's components. If you want to ensure consistency, you might need to explicitly set both the Prefect logging level and the Python root logger level.
3. Environment Variables: You can set the environment variable PREFECT_LOGGING_ROOT_LEVEL
to match PREFECT_LOGGING_LEVEL
if you want both to reflect the same logging level.
For further details on configuring logging in Prefect, you can refer to the Prefect Logging Documentation.
If this behavior is new, consider checking if there have been changes in your environment or Prefect version that might affect logging configurations.Daniel Manson
02/17/2025, 5:20 PMPREFECT_LOGGING_ROOT_LEVEL
does do the trick