I need to have log of each execution #3462
Replies: 3 comments 1 reply
-
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.
-
Hi @antonpirker : Thanks for your comment and proposed line of work. This is the path I am using in my code. I set the logger level to “info”, and log events using “logger.info”. Finally I force the saving via: sentry_sdk.capture_message("[Fin] ### Fin de Ejecucion ###", level="info") But the result is that I get a failure rate of 100% in Performance. I attach some screenshots. Any other ideas, what could I be doing wrong? |
Beta Was this translation helpful? Give feedback.
-
Hi, I have created a new project just as indicated @antonpirker , with this code: And I use a new project in sentry.io for this test. But I get errors: And I receive e-mail notification of the error: How can I solve this? Thanks!!! |
Beta Was this translation helpful? Give feedback.
-
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