Describe the bug
Using Bugsnag with https://github.com/yiisoft/yii2, logged errors are not flushed to Bugsnag with batching enabled.
- Exceptions seem to work, just not logged errors
- If I disable batching (
$bugsnagClient->setBatchSending(false);
By settings some breakpoints, I can see that the order of operations seems off:
\Bugsnag\Shutdown\PhpShutdownStrategy::registerShutdownStrategy
\Bugsnag\Client::flush (queue is empty)
\Bugsnag\Client::notify (after which, queue has report)
As you can see, flush seems to be getting called before notify, so the reports never get flushed to Bugsnag.
This seems to be because Yii's logger has its own register_shutdown_function to flush its logs, but is always called last. In this case Bugsnag's shutdown needs to be called after, or no logs exist.
Environment
- Bugsnag version: 3.28
- PHP version: 8.1
- Integration framework version:
- Craft CMS@4.0.4 (Yii@2.0.45)
Describe the bug
Using Bugsnag with https://github.com/yiisoft/yii2, logged errors are not flushed to Bugsnag with batching enabled.
$bugsnagClient->setBatchSending(false);By settings some breakpoints, I can see that the order of operations seems off:
\Bugsnag\Shutdown\PhpShutdownStrategy::registerShutdownStrategy\Bugsnag\Client::flush(queue is empty)\Bugsnag\Client::notify(after which, queue has report)As you can see, flush seems to be getting called before notify, so the reports never get flushed to Bugsnag.
This seems to be because Yii's logger has its own
register_shutdown_functionto flush its logs, but is always called last. In this case Bugsnag's shutdown needs to be called after, or no logs exist.Environment