Download the PHP package forci/catchable-bundle without Composer
On this page you can find all versions of the php package forci/catchable-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download forci/catchable-bundle
More information about forci/catchable-bundle
Files in forci/catchable-bundle
Package catchable-bundle
Short Description A bundle to collect your unhandled exceptions
License MIT
Informations about the package catchable-bundle
Register the bundle as usual and mount its routing.
For this bundle to make any sense at all, you need to create a separate connection and a separate entity manager.
From version 0.7 and up, you no longer need any config for this bundle.
Follow https://symfony.com/doc/4.4/doctrine/multiple_entity_managers.html and map ForciCatchableBundle to your separate EM.
Better yet, create a completely separate database. Having a separate entity manager will also mean you will NOT be able to migrate this with DoctrineMigrationsBundle as it does NOT support multiple entity managers (at least to my knowledge). So create/update your separate database as per your project's deployment strategy and/or needs.
The above configuration uses the default one and WILL NOT WORK in case you have an exception thrown by Doctrine, as it will also close the entity manager which is responsible for writing it to the database.
WARNING: This bundle is NOT meant to be a replacement for your file or else logging. It is meant to work alongside your existing infrastructure and make viewing errors easier and nicer via your admin interface.
Purging old catchables (retention)
The catchables table only grows — every caught throwable is persisted and nothing removes old rows, so on a busy app it will eventually fill the disk. The forci:catchable:purge command deletes catchables older than a retention window (against whichever entity manager maps the entity). Run it from cron.
Optionally set a default window so the scheduled command can run with no arguments:
--days overrides the configured default. If neither is set, the command deletes nothing and tells you to provide one.
Versions >= ~0.6
In your config_prod.yml
You could also pass Catchable's logs through a FilterHandler to get rid of bloat such as deprecations. This allows you to only have critical error information persisted, but deprecations logged to a file by the remaining handlers. Either use accepted_levels or min_level / max_level, whichever suits your needs best. Just be careful if allowing deprecations to be persisted. Upon many 404 errors, you'll get the database fill up quickly with redundant data. In the future, functionality like ignored errors (such as the aforementioned HttpNotFoundException) will be added.
Alternatively, instead of fingers_crossed, you could use a filter or buffer or any other handler. Please note: When using buffer, it must flush at some point. This must also happen BEFORE the ExceptionSubscriber is fired. As it is, using it alongside your fingers_crossed file and/or email logging is the best approach. Other handlers haven't been tested with Catchable's buffer service. Use at your own risk.
Versions <= ~0.5
In your config.yml
Where entity_manager is your SEPARATE entity manager.
In your config_prod.yml
This handler will collect all the logs and store them in an array, which will be available for Catchable's subscriber and saved to the database Exception entry.
This also makes it possible for you to use the logger and log critical data that may be important in case of a disaster.
Then, make a link somewhere in your app to
Enjoy!
Release 0.6
- Improved buffer handler. You can now configure it in your main chain of handlers.
- Removed deprecations. Allows Symfony 5 compatibility.
- Now uses
FlattenExceptionfrom Symfony'sErrorHandlercomponent, rather thanDebug. - Removed hack around serializing
\Throwablevia the deprecatedFatalThrowableErrorclass.
Upgrade 0.5 -> 0.6
- Symfony requirements are now ~4.4|~5.0
- The
Forci\Bundle\Catchable\Serializer\ExceptionSerializerservice is removed. All of its code are now inForci\Bundle\Catchable\Collector\ThrowableCollector - The
forci.catchable.handler.limitless_bufferservice has been removed in favor of a simplerforci.catchable.monolog.handler.log_buffer - Your buffering and/or filtering logic must now be handled by any of the built-in Monolog handlers. This makes buffering relevant logs more streamlined and in line with your other handlers.
--
TODOs
- Make it possible to ignore an exception class
- Add a "Hide User Deprecated" checkbox that hides log messages starting with "User Deprecated"
- Add file and message hashes, search by hash instead for better performance as these are text and have no indexes (Blame Doctrine for not allowing to specify index length)
- Rename to ExceptionBundle, ExceptionCollector, ExceptionSerializer, etc
- Add filter exceptions config
- Hash Error type, file, line, message, current DATE/HOUR and increment an "occurrences" counter @ Catchable Entity
All versions of catchable-bundle with dependencies
symfony/framework-bundle Version ~5.0|~6.0|~7.0|~8.0
symfony/form Version ~5.0|~6.0|~7.0|~8.0
monolog/monolog Version ^1.25.3|^2|^3
doctrine/doctrine-bundle Version ~1.12|~2.0|~3.0
doctrine/orm Version ~2.6|~3.0