Logging
Learn how to control and customize logging behavior in ZenML pipelines.
Last updated
Was this helpful?
Learn how to control and customize logging behavior in ZenML pipelines.
Last updated
Was this helpful?
By default, ZenML uses a logging handler to capture two types of logs:
Pipeline run logs: Logs collected from your ZenML client while triggering and waiting for a pipeline to run. These logs cover everything that happens client-side: building and pushing container images, triggering the pipeline, waiting for it to start, and waiting for it to finish. These logs are now stored in the artifact store, making them accessible even after the client session ends.
Step logs: Logs collected from the execution of individual steps. These logs only cover what happens during the execution of a single step and originate mostly from the user-provided step code and the libraries it calls.
For step logs, users are free to use the default python logging module or print statements, and ZenML's logging handler will catch these logs and store them.
All these logs are stored within the respective artifact store of your stack. You can visualize the pipeline run logs and step logs in the dashboard as follows:
Local ZenML server (zenml login --local
): Both local and remote artifact stores may be accessible
Deployed ZenML server: Local artifact store logs won't be accessible; remote artifact store logs require configuration (see )
In order for logs to be visible in the dashboard with a deployed ZenML server, you must configure both a remote artifact store and the appropriate service connector to access it. Without this configuration, your logs won't be accessible through the dashboard.
For all logging configurations below, note:
Setting environment variables on your local machine only affects local pipeline runs
For remote pipeline runs, you must set these variables in the pipeline's execution environment using Docker settings:
You can control log storage for both pipeline runs and steps:
To disable storing step logs in your artifact store:
Using the enable_step_logs
parameter with step decorator:
Setting the ZENML_DISABLE_STEP_LOGS_STORAGE=true
environment variable in the execution environment:
This environment variable takes precedence over the parameter mentioned above.
To disable storing client-side pipeline run logs in your artifact store:
Using the enable_pipeline_logs
parameter with pipeline decorator:
Using the runtime configuration:
Setting the ZENML_DISABLE_PIPELINE_LOGS_STORAGE=true
environment variable:
The environment variable takes precedence over parameters set in the decorator or runtime configuration.
Change the default logging level (INFO
) with:
Options: INFO
, WARN
, ERROR
, CRITICAL
, DEBUG
For remote pipeline runs:
Change the default logging format with:
Disable colorful logging with:
By default, ZenML adds step name prefixes to console logs:
These prefixes only appear in console output, not in stored logs. Disable them with:
Use appropriate log levels:
DEBUG
: Detailed diagnostic information
INFO
: Confirmation that things work as expected
WARNING
: Something unexpected happened
ERROR
: A more serious problem occurred
CRITICAL
: A serious error that may prevent continued execution
Include contextual information in logs
Log at decision points to track execution flow
Avoid logging sensitive information
Use structured logging when appropriate
Configure appropriate verbosity for different environments
The format must use %
-string formatting style. See .
ZenML uses for enhanced traceback display. Disable it with: