vasek-purchart/console-errors-bundle
Composer 安装命令:
composer require vasek-purchart/console-errors-bundle
包简介
Logging of exceptions and error codes for Symfony Console
README 文档
README
Logging of exceptions and error codes for Symfony Console.
This bundle ensures all uncaught exceptions and errors are logged in the same way as exceptions from controllers.
It also logs all command executions which ended with non-zero exit code.
Here is an example showing an exception, error and non-zero exit code:

And these are corresponding log entries:
[2015-05-19 12:41:19] app.ERROR: Exception: Hello Exception! (uncaught exception) at /home/vasek/dev/projects/console-errors-bundle/framework-standard-edition/src/AppBundle/Console/HelloCommand.php line 23 while running console command `hello:world` {"exception":"[object] (Exception(code: 0): Hello Exception! at /home/vasek/dev/projects/console-errors-bundle/framework-standard-edition/src/AppBundle/Console/HelloCommand.php:23)"} []
[2015-05-19 12:41:58] app.ERROR: Symfony\Component\Debug\Exception\ContextErrorException: Notice: Undefined variable: foo (uncaught exception) at /home/vasek/dev/projects/console-errors-bundle/framework-standard-edition/src/AppBundle/Console/HelloCommand.php line 23 while running console command `hello:world` {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Notice: Undefined variable: foo at /home/vasek/dev/projects/console-errors-bundle/framework-standard-edition/src/AppBundle/Console/HelloCommand.php:23)"} []
[2015-05-19 12:42:13] app.ERROR: Command `hello:world` exited with status code 123 [] []
Configuration
Configuration structure with listed default values:
# config/packages/console_errors.yaml console_errors: exceptions: # Enable logging for exceptions. enabled: true # Log level with which exceptions should be logged (accepts string or integer values). log_level: 'error' # Priority with which the listener will be registered. listener_priority: 0 exit_code: # Enable logging for non-zero exit codes. enabled: true # Log level with which exit codes should be logged (accepts string or integer values). log_level: 'error' # Priority with which the listener will be registered. listener_priority: 0
Symfony by default always converts errors to PHP exceptions. Warnings and notices are converted by default only in development environment. If you want to configure your application to always convert warnings and notices to exceptions use the debug.error_handler.throw_at parameter (see PHP manual for other available values):
# config/packages/framework.yaml parameters: debug.error_handler.throw_at: -1
You can also override services used internally, for example if you use a non standard logger, you can provide custom instance with an alias:
services: my_logger: class: 'Monolog\Logger' arguments: $name: 'my_channel' vasek_purchart.console_errors.console.logger: '@my_logger'
Installation
Install package vasek-purchart/console-errors-bundle with Composer:
composer require vasek-purchart/console-errors-bundle
Register the bundle in your application:
// config/bundles.php return [ // ... VasekPurchart\ConsoleErrorsBundle\ConsoleErrorsBundle::class => ['all' => true], ];
vasek-purchart/console-errors-bundle 适用场景与选型建议
vasek-purchart/console-errors-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 217.13k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2015 年 05 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「symfony」 「debug」 「exception」 「error」 「bundle」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vasek-purchart/console-errors-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vasek-purchart/console-errors-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vasek-purchart/console-errors-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Debug your SimpleBus EventBus and CommandBus
nice output for debug functions for PHP 5.3
The bundle for easy using json-rpc api on your project
A Zend Framework module that sets up Monolog for logging in applications.
Analysis module for finding problematical shop data.
Twig extensions for Tracy Debugger
统计信息
- 总下载量: 217.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-19