# How best to warn in Python: logs or \`warnings\`?

**URL:** <https://www.rubin.community/t/how-best-to-warn-in-python-logs-or-warnings/4733>\
**Category:** Data Management\
**Created:** [February 17, 2021, 6:15pm UTC](https://www.rubin.community/t/how-best-to-warn-in-python-logs-or-warnings/4733 "2021-02-17T18:15:11Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![parejkoj](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/parejkoj/32/138_2.png) [@parejkoj](https://www.rubin.community/u/parejkoj)\
**Post date:** [February 18, 2021, 8:27pm UTC](https://www.rubin.community/t/how-best-to-warn-in-python-logs-or-warnings/4733/4 "2021-02-18T20:27:28Z")

</div>

This seems quite related to this earlier discussion that @kfindeisen and I caused: [Warnings or other not-errors in the Stack](http://www.rubin.community/t/warnings-or-other-not-errors-in-the-stack/3452/4). Although that was more about what to do with not-quite-failure conditions, it also proposed using `warnings.warn`.

I think my main worry now is what happens to those `warnings.warn()` messages in our logging and production environment. Would they just get swallowed up like `print()` does, or would they be captured, and how would you know which Task they came from?

---

_[View the full topic](https://www.rubin.community/t/how-best-to-warn-in-python-logs-or-warnings/4733)._
