I need to have log of each execution #3462
Unanswered
RandomBrown
asked this question in
Q&A
Replies: 1 comment
-
Hey @RandomBrown ! I tried this now with this example code: import os
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
import logging
logging.basicConfig(level=logging.INFO)
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
release="42.42.42",
enable_tracing=True,
debug=True,
integrations=[
LoggingIntegration(level=logging.INFO, event_level=logging.ERROR)
],
)
with sentry_sdk.start_transaction(op="function", name="plain-python-example-new"):
logging.info("Hello, World! 1")
logging.info("Hello, World! 2")
logging.info("Hello, World! 3")
logging.info("Hello, World! 4")
logging.info("Hello, World! 5")
sentry_sdk.capture_message("[End] ### End of Execution ###", level="info") And I get the breadcrumbs in the message (as you described): (notice the transaction name is So I guess this should work as you expect. Did I got something wrong? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I use the logging library to log info messages for an application, and I generate a log file for each execution.
However, I want to have visibility of these messages from sentry.io, and be able to visualize them for each execution.
To achieve this, I am currently using the integration between sentry.io and logging, with a configuration of sentry_sdk.init as follows:
integrations=[LoggingIntegration(level=logging.INFO, event_level=logging.ERROR)]
And I manually generate an info event in sentry.io to provide observability at the end of execution, allowing me to see all the breadcrumbs:
sentry_sdk.capture_message("[End] ### End of Execution ###", level="info")
The result is as expected, except that sentry.io considers this level=“info” event as an error. For example, when I check the performance option, I see a 100% failure rate due to these messages.
Can I approach this from a different perspective, so that I still have this observability with each execution of the application, but without sentry.io considering it an error?
Beta Was this translation helpful? Give feedback.
All reactions