Fugo Takefusa
10/01/2025, 10:45 PMcurl https://<prefect-server-url>/api/admin/version
)Liliya Angelova
10/03/2025, 8:34 AMLiliya Angelova
10/03/2025, 8:42 AMLiliya Angelova
10/03/2025, 11:18 AMprint("Prefect logger handlers:", logging.getLogger("prefect").__dict__)
is called, the logger is created so play around with that and see if this actually solves the problem for you 🤞
import os
import logging, prefect
from prefect import flow, get_run_logger
# Configure Python logging globally
logging.basicConfig(
level=<http://logging.INFO|logging.INFO>, # capture DEBUG and above
format="%(asctime)s | %(levelname)s | %(name)s | %(message)s"
)
from prefect.settings import PREFECT_API_URL, PREFECT_LOGGING_TO_API_ENABLED
print("Prefect:", prefect.__version__)
print("API URL:", PREFECT_API_URL.value())
print("Logging to API:", PREFECT_LOGGING_TO_API_ENABLED.value())
print("Prefect logger handlers:", logging.getLogger("prefect").__dict__)
@flow
def debug_env():
# Get Prefect logger
logger = get_run_logger()
# Environment variables
<http://logger.info|logger.info>(f"PREFECT_API_URL={os.environ.get('PREFECT_API_URL')}")
<http://logger.info|logger.info>(f"PREFECT_LOGGING_TO_API_ENABLED={os.environ.get('PREFECT_LOGGING_TO_API_ENABLED')}")
<http://logger.info|logger.info>(f"PREFECT_LOGGING_SETTINGS_PATH={os.environ.get('PREFECT_LOGGING_SETTINGS_PATH')}")
if __name__ == "__main__":
debug_env()
Liliya Angelova
10/03/2025, 11:18 AM