Prefect 2.7.11 is here with expanded logging, collection updates, and more

We just shipped Prefect 2.7.11 with expanded logging! :wood:

One of the best things about Prefect 2 is that not every function has to be orchestrated. That flexibility is great, but users told us that even if they weren’t orchestrating everything, they still wanted to be able to see logs in a single place.

Now, Prefect defaults to displaying a warning instead of raising an error when you use Prefect loggers outside of flow or task runs.

We’ve also added a setting, PREFECT_LOGGING_ORION_WHEN_MISSING_FLOW, to allow configuration of this behavior to silence the warning or raise an error as before. This means that you can attach Prefect’s logging handler to existing loggers without breaking your workflows. Check it out:

from prefect import flow 
import logging 

my_logger = logging.getLogger("my-logger")"outside the flow") 

def foo():"inside the flow") 

if __name__ == "__main__": 

You can even see messages from my-logger in the UI with PREFECT_LOGGING_EXTRA_LOGGERS :

$ PREFECT_LOGGING_EXTRA_LOGGERS="my-logger" python UserWarning: Logger 'my-logger' attempted to send logs to Orion without a flow run id. The Orion log handler can only send logs within flow run contexts unless the flow run id is manually provided."outside the flow")
18:09:30.518 | INFO    | my-logger - outside the flow
18:09:31.028 | INFO    | prefect.engine - Created flow run 'elated-curassow' for flow 'foo'
18:09:31.104 | INFO    | my-logger - inside the flow
18:09:31.179 | INFO    | Flow run 'elated-curassow' - Finished in state Completed()


We made some useful enhancements, including:

  • Friendlier default task run names :smiley_cat:#8292
  • Our Docker images now update preinstalled packages when they’re built :anchor:#8288
  • Clearer CLI output when switching profiles :keyboard: - #8383

Collection updates

Check out the release notes for information on the other enhancements and fixes in this release.

Special thanks to Chia Berry, @Hans Lellelid, and Tomek for their contributions to this release!

Happy Engineering! :computer: :wrench: