Set logging format

How to set the logging format in ZenML.

If you want to change the default ZenML logging format, you can do so with the following environment variable:

export ZENML_LOGGING_FORMAT='%(asctime)s %(message)s'

The logging format must use the %-string formatting style. Check out this page for all available attributes.

Note that setting this on the client environment (e.g. your local machine which runs the pipeline) will not automatically change the log format on remote pipeline runs. That means setting this variable locally with only effect pipelines that run locally.

If you wish to configure it also for remote pipeline runs, you can set the ZENML_LOGGING_FORMAT environment variable in your pipeline runs environment as follows:

from zenml import pipeline
from zenml.config import DockerSettings

docker_settings = DockerSettings(environment={"ZENML_LOGGING_FORMAT": "%(asctime)s %(message)s"})

# Either add it to the decorator
@pipeline(settings={"docker": docker_settings})
def my_pipeline() -> None:
    my_step()

# Or configure the pipelines options
my_pipeline = my_pipeline.with_options(
    settings={"docker": docker_settings}
)
ZenML Scarf

Last updated

Was this helpful?