We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

User GuideLogging

Logging

Hatchet comes with a built-in logging view where you can push logs from your workflows. This is useful for debugging and monitoring your workflows.

You can use either Python’s built-in logging package, or the context.log method for more control over the logs that are sent.

Using the built-in logging package

You can pass a custom logger to the Hatchet class when initializing it. For example:

It’s recommended that you pass the root logger to the Hatchet class, as this will ensure that all logs are captured by the Hatchet logger. If you have workflows defined in multiple files, they should be children of the root logger. For example, with the following file structure:

  • client.py
  • worker.py
    • workflow.py

You should pass the root logger to the Hatchet class in client.py:

And then in workflows/workflow.py, you should create a child logger:

Using the context.log method

You can also use the context.log method to log messages from your workflows. This method is available on the Context object that is passed to each task in your workflow. For example:

Each task is currently limited to 1000 log lines.