Nick
01/30/2025, 12:13 AMMarvin
01/30/2025, 12:14 AMget_run_logger()
from the prefect.logging
module to get a logger instance that is aware of the current flow or task run context. This allows logs to be captured and explored in the Prefect UI or API based on relevant run information like run ID and name.
2. Python Loggers: You can also use a normal Python logger with the get_logger()
function from prefect.logging
. However, logs from this logger will not be sent to the Prefect API by default.
3. Configuration: You can configure logging settings through Prefect settings or by providing your own logging.yml
file. This file can be placed in your PREFECT_HOME
directory or specified with the PREFECT_LOGGING_SETTINGS_PATH
setting. The configuration can include setting the logging level or customizing the logging behavior.
For more details on configuring logging in Prefect, you can refer to the Prefect logging documentation.Nick
01/30/2025, 12:24 AMMarvin
01/30/2025, 12:24 AMget_run_logger()
within a flow or task. This logger is context-aware and ensures that logs are associated with the correct flow or task run in the Prefect UI and API.
2. Extra Loggers: If you want to include logs from other libraries, you can configure the PREFECT_LOGGING_EXTRA_LOGGERS
setting. This setting allows you to specify additional Python library names whose logs you want to capture and send to the server.
3. Logging Configuration: You can customize the logging configuration using a logging.yml
file. This file can be placed in your PREFECT_HOME
directory or specified with the PREFECT_LOGGING_SETTINGS_PATH
setting. This allows you to define handlers, formatters, and other logging settings.
For more detailed instructions, you can refer to the Prefect logging documentation.