jenssegers/rollbar
Composer 安装命令:
composer require jenssegers/rollbar
包简介
Rollbar error monitoring integration for Laravel projects
README 文档
README
Rollbar error monitoring integration for Laravel projects. This library adds a listener to Laravel's logging component. Laravel's session information will be sent in to Rollbar, as well as some other helpful information such as 'environment', 'server', and 'session'.
Installation
Install using composer:
composer require jenssegers/rollbar
Add the service provider to the 'providers' array in config/app.php:
Jenssegers\Rollbar\RollbarServiceProvider::class,
If you only want to enable Rollbar reporting for certain environments you can conditionally load the service provider in your AppServiceProvider:
public function register() { if ($this->app->environment('production')) { $this->app->register(\Jenssegers\Rollbar\RollbarServiceProvider::class); } }
Configuration
This package supports configuration through the services configuration file located in config/services.php. All configuration variables will be directly passed to Rollbar:
'rollbar' => [ 'access_token' => env('ROLLBAR_TOKEN'), 'level' => env('ROLLBAR_LEVEL'), ],
The level variable defines the minimum log level at which log messages are sent to Rollbar. For development you could set this either to debug to send all log messages, or to none to sent no messages at all. For production you could set this to error so that all info and debug messages are ignored.
Usage
To automatically monitor exceptions, simply use the Log facade in your error handler in app/Exceptions/Handler.php:
public function report(Exception $exception) { \Log::error($exception); //rollbar parent::report($exception); }
For Laravel 4 installations, this is located in app/start/global.php:
App::error(function(Exception $exception, $code) { Log::error($exception); });
Your other log messages will also be sent to Rollbar:
\Log::debug('Here is some debug information');
NOTE: Fatal exceptions will always be sent to Rollbar.
Context informaton
You can pass user information as context like this:
\Log::error('Something went wrong', [ 'person' => ['id' => 123, 'username' => 'John Doe', 'email' => 'john@doe.com'] ]);
Or pass some extra information:
\Log::warning('Something went wrong', [ 'download_size' => 3432425235 ]);
jenssegers/rollbar 适用场景与选型建议
jenssegers/rollbar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.08M 次下载、GitHub Stars 达 324, 最近一次更新时间为 2014 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「logging」 「error」 「monitoring」 「laravel」 「rollbar」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jenssegers/rollbar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jenssegers/rollbar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jenssegers/rollbar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
A Zend Framework module that sets up Monolog for logging in applications.
SoftWax Health Check Bundle for Symfony framework
1Pilot client for Symfony
Statsd (Object Oriented) client library for PHP
Asynchronous Sentry for Symfony - Fire and forget
统计信息
- 总下载量: 1.08M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 330
- 点击次数: 27
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-04-27