Comments (4)
Ah, did not think of that myself. Cheers, that's an acceptable alternative.
from bugsnag-php.
Hi @alcohol, thanks for the suggestion! Can you tell us a little more about why you think this feature would be useful? For example are you getting spammed with large numbers of these log messages?
from bugsnag-php.
Yeah, unfortunately. My client has a legacy application that needs a lot of patching and fixing, and this noise is making it a bit awkward to spot other issues.
We only discard the following classes in my client's codebase:
- Symfony\Component\HttpKernel\Exception\NotFoundHttpException
- Symfony\Component\Security\Core\Exception\AccessDeniedException
- Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException
But if I peek at the log of the php-fpm service on our servers using journalctl
I basically just see a flood of these:
Mar 03 09:49:08 <hostname> php-fpm8.1[1442507]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:49:08 <hostname> php-fpm8.1[1442640]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:49:38 <hostname> php-fpm8.1[1443398]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:49:38 <hostname> php-fpm8.1[1442843]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:49:40 <hostname> php-fpm8.1[1443398]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:49:54 <hostname> php-fpm8.1[1443620]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:49:54 <hostname> php-fpm8.1[1443398]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:49:54 <hostname> php-fpm8.1[1442640]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:50:02 <hostname> php-fpm8.1[1442507]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:50:03 <hostname> php-fpm8.1[1442843]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:03 <hostname> php-fpm8.1[1442640]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:04 <hostname> php-fpm8.1[1442507]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:04 <hostname> php-fpm8.1[1443620]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:04 <hostname> php-fpm8.1[1443398]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:04 <hostname> php-fpm8.1[1442843]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:04 <hostname> php-fpm8.1[1443620]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:04 <hostname> php-fpm8.1[1442508]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:08 <hostname> php-fpm8.1[1442650]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:50:08 <hostname> php-fpm8.1[1443620]: ool fpm: Discarding event because error class "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" matched discardClasses configuration
Mar 03 09:50:10 <hostname> php-fpm8.1[1442843]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:10 <hostname> php-fpm8.1[1442507]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:11 <hostname> php-fpm8.1[1443887]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
Mar 03 09:50:11 <hostname> php-fpm8.1[1442843]: ool fpm: Discarding event because error class "Symfony\Component\Security\Core\Exception\AccessDeniedException" matched discardClasses configuration
from bugsnag-php.
Got it, thanks for the additional details. You should be able to achieve that by removing your discardClasses
configuration and instead registering your own callback to check for and discard these errors without the syslog
call.
The callback gets added to the middleware pipeline and is passed a $report
object so you could do something similar to the internal middleware implementation and simply return false
from the callback to discard the report:
bugsnag-php/src/Middleware/DiscardClasses.php
Lines 31 to 46 in ad2b40b
from bugsnag-php.
Related Issues (20)
- Joomla integration ? similar Wordpress.. HOT 1
- StyleCI not working HOT 9
- Packagist hooks need updating HOT 1
- Unable to install on PHP 5.5 HOT 5
- PHP 7.2: count(): Parameter must be an array or an object that implements Countable HOT 3
- Session handler design HOT 1
- Consider using phpstan (or another analyser) on the codebase HOT 2
- Memory exhaustion error reports are lost HOT 4
- setRedactedKeys cannot support non-regex and regex filters at the same time HOT 7
- Downstream Vulnerability - Guzzle <1.8.4 >=2.0.0, <2.1.1 HOT 3
- Is payloadVersion set on the wrong object? HOT 2
- Yii2: Logs are not flushed on shutdown HOT 5
- Error running tests with php7.4 HOT 5
- Unable to modify breadcrumbs from registerCallback HOT 3
- Redact command-line options HOT 4
- New Relic PHP extension causes duplicate errors in BugSnag HOT 2
- startSession immediately triggers deliverSessions HOT 1
- API keys for service accounts
- SSL certificate problem: self-signed certificate in certificate chain
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bugsnag-php.