question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Logging integration to capture all logged exceptions

See original GitHub issue

Is your feature request related to a problem? Please describe. Instrumenting an existing application can be cumbersome: All places with exception handling need to be extend in order to also forward the errors to APM using client.capture_exception(). However, most of the time such code paths are already well covered with logger.exception(...) or similar.

Describe the solution you’d like The APM library should offer an opt-in feature to automatically forward all logged exceptions to APM. This could be an automatic feature similar to how HTTP libraries get instrumented.

Describe alternatives you’ve considered The APM logging.LoggingHandler class offers such functionality. However the capturing is hereby bound to a specific output format. It cannot easily be used together with structlog

This feature request is inspired by the integration offered by Sentry https://docs.sentry.io/platforms/python/guides/logging/.

Additional context n/a

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
process0commented, Aug 16, 2021

Theoretically we’re already forwarding unhandled exceptions via our framework integrations. Plus you can use our excepthook to make the capturing behavior even more broad.

For celery integration, if an exception happens outside a task, then it isn’t forwarded. I didn’t see excepthook. I’ll try it out.

0reactions
basepicommented, Aug 16, 2021

Theoretically we’re already forwarding unhandled exceptions via our framework integrations. Plus you can use our excepthook to make the capturing behavior even more broad.

But perhaps it’s worth adding another place in structlog as in your example. Thanks for the input, it’s really valuable!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python logging automatically capture all the exception
Is there a way that automatically capture all the exceptions occurred through 'logging' module and write them into a .log file?
Read more >
Logging and Exception handling : Best Practices - webMethods
I am currently involved in a project where we are implermenting the following webMethods components: webMethods Integration Server v6.0.1 ...
Read more >
5 Awesome Retrace Logging & Error Tracking Features
1. Organize your logs with structured logging and #tags · 2. Find all the exceptions being thrown in your code · 3. View...
Read more >
Logging Exceptions in Salesforce - Avenga
If an exception occurs after inserting the error log record into a database, the entire transaction will be rolled back. Your ErrorLog__c record...
Read more >
Capture exceptions and log technical errors - Integration Matters
A LogError activity is used whenever the user explicitly captures an error by design. Exceptions are typically captured using the “Catch” activity. It...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found