Comments (5)
Not sure if this is the best solution, but I've fixed this by registering my own shutdown function:
<?php
namespace craftnet\logs;
use Bugsnag\Client;
use Bugsnag\Shutdown\ShutdownStrategyInterface;
use Craft;
/**
* Class PhpShutdownStrategy.
*
* Use the built-in PHP shutdown function
*/
class PhpShutdownStrategy implements ShutdownStrategyInterface
{
/**
* @param Client $client
*
* @return void
*/
public function registerShutdownStrategy(Client $client): void
{
register_shutdown_function(static function() use($client) {
Craft::$app->getLog()->logger->flush(true);
$client->flush();
});
}
}
Sidenote: it would be nice if Bugsnag\Client::make
accepted an argument to pass the shutdownStrategy
.
from bugsnag-php.
Hi @timkelty, just to confirm, does this issue only occur when batch sending is enabled?
from bugsnag-php.
@yousif-bugsnag correct – if I disable batch sending, it works, because it sends them immediately and doesn't need to wait for the shutdown handler
from bugsnag-php.
HI @timkelty,
The Yii2 framework is not something we officially support as there are some more significant differences to other PHP frameworks. I suspect the issue you are reporting could be due to these differences. Full support for Yii2 is on our roadmap but I don't have a timeframe at the moment. I have noted your interest and use case and will let you know here as soon as we have updates.
For now your workaround would seem perfectly reasonable if it is suiting your needs.
As a slight aside, there is a third party Yii2 Bugsnag notifier library that someone has created, so that might be of interest to you: https://github.com/pinfirestudios/yii2-bugsnag. However its worth noting Bugsnag has no connection to this so we cannot support it nor verify if it works correctly.
from bugsnag-php.
@johnkiely1 thanks!
FWIW, this is for Craft CMS@4 (Yii2 under the hood), which uses Monolog for logging, so we're currently getting Bugsnag integration through https://packagist.org/packages/mead-steve/mono-snag
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
- Option to disable syslog() call HOT 4
- Downstream Vulnerability - Guzzle <1.8.4 >=2.0.0, <2.1.1 HOT 3
- Is payloadVersion set on the wrong object? HOT 2
- 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.