exs/error-bundle
Composer 安装命令:
composer require exs/error-bundle
包简介
Error logging bundle for Symfony2
README 文档
README
Error bundle to log 4xx and 5xx errors and exceptions in the database.
Bundle is installed as a service listening for all 4xx and 5xx http exceptions and logs them in the database. When used in conjunction with a crontab enabled monitor we can then alert the dev team when there are hightened number of errors on the site and issue a rapid fix if necessary.
Installing the ErrorBundle in a new Symfony2 project
So the ErrorBundle is ready for installation, great news but how do we install it. The installation process is actually very simple. Set up a new Symfony2 project with Composer.
Require from the command line directly:
composer require 'exs/error-bundle:1.0'
Once the new project is set up, open the composer.json file and add the exs/error-bundle as a dependency:
//composer.json //... "require": { //other bundles "exs/error-bundle": "~1.0@dev"
Save the file and have composer update the project via the command line:
php composer.phar update
Composer will now update all dependencies and you should see our bundle in the list:
- Installing exs/error-bundle (dev-master 0c644b1)
Cloning 0c644b1315e75cd4ff521eeea0ee3243faad0ce3
Now just update the app/AppKernel.php and app/config/routing.yml to include our bundle, clear the cache and update the schema:
//app/AppKernel.php //... public function registerBundles() { $bundles = array( //Other bundles new EXS\ErrorBundle\EXSErrorBundle() );
add routing.yml:
#app/config/routing.yml
#...
contact:
resource: "@EXSErrorBundle/Controller/"
type: annotation
prefix: /
add the bundle to orm configuration:
#app/config/config.yml
#...
orm:
auto_generate_proxy_classes: "%kernel.debug%"
default_entity_manager: default
entity_managers:
default:
connection: default
mappings:
AppBundle: ~
EXSErrorBundle: ~
add deprecated errors params:
# parameters.yml:
deprecated_errors_logging: false
clear cache and update database:
php app/console cache:clear php app/console doctrine:schema:update --force
and now you're done.
You can test that it works by throwing 500 and 400 series errors from your app. The errors will be logged (along with useful debugging information) in your database in the following tables:
-
exception4xx
-
exception5xx
If you wish to test the exceptions being thrown via the included controller you can try the following routes
If you want to test the console exceptions try:
php app/console _test:command:fatal php app/console _test:command:notice php app/console _test:command:exception
Contributing
Anyone and everyone is welcome to contribute.
If you have any questions or suggestions please let us know.
exs/error-bundle 适用场景与选型建议
exs/error-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.31k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2015 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「error」 「bundle」 「404」 「500」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 exs/error-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 exs/error-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 exs/error-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
A Zend Framework module that sets up Monolog for logging in applications.
DMS Meetup API Bundle, enables Meetup API clients in services
Asynchronous Sentry for Symfony - Fire and forget
统计信息
- 总下载量: 6.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 25
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-13