We want to enable Sentry error forwarding for our Kubernetes Deployments. In the
__init__.py of the main package folder so
root/package/__init__.py we set up Sentry like this:
import logging from os import environ import sentry_sdk logging.info("initializing sentry") sentry_sdk.init( release=environ.get("SENTRY_RELEASE"), environment=environ.get("SENTRY_ENVIRONMENT") )
This works just fine, it correctly pushes errors to Sentry for us to examine but one large issue is that it seems to completely eat any logs we write using
logging.info(...) in any other location, so nothing is written to
stdout. This is a problem, as we frequently examine logging trails in Stackdriver for debugging and monitoring.
We set up a logging config in an internal python package like this:
logging.basicConfig( format="%(asctime)s - %(module)s.py:%(funcName)s:%(lineno)s - %(levelname)s - %(message)s", level=logging.INFO, )
Thanks a lot in advance! Please let me know if you need more info.