Awesome
Tracy BlueScreen handler for Symfony (Monolog)
This package is not maintained anymore, you can use mangoweb/monolog-tracy-handler instead.
Sponzored by Shipito LLC.
Bundle providing mainly integration of Tracy into Symfony.
Are you looking for Monolog integration only? There is Monolog-Tracy.
Tracy - Blue Screen Handler
Long story short, Tracy helps you debug your applications when an error occurs providing you lots of information about what just happened. Check out live example and Tracy documentation to see the full power of this tool.
To replace default Symfony Bluescreen you can use Tracy Bluescreen Bundle fully compatible with this library.
Installation
Using Composer:
$ composer require nella/monolog-tracy-bundle
Register Bundle
// AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Nella\MonologTracyBundle\MonologTracyBundle(),
);
}
Register a new Monolog handler
monolog:
handlers:
blueScreen:
type: tracyBlueScreen
Configuration
Any error/exception making it to the top is automatically saved in %kernel.logs_dir%/tracy
. You can easily change the log directory,
see full configuration options below:
# config.yml
monolog_tracy:
log_directory: %kernel.logs_dir%/tracy # default
handler_level: DEBUG # or 100 default - you can use int or constant name
handler_bubble: true # default
info_items:
- Symfony 3.0.1 # default if HttpKernel is present
- Doctrine ORM 2.5.2 # default if Doctrine ORM is present
- Twig 1.23.1 # default if Twig is present
panels: # no default panels
- test.nella.monolog_tracy_bundle.panel.test_panel # callable ([class, method], [@service, method], @service, class::service)
collapse_paths: # no default collapse paths
- %kernel.root_dir%/vendor # TIP
This works out of the box and also in production mode!
Tips
Log notices/warnings in production
Use Symfony parameter debug.error_handler.throw_at
: (see http://php.net/manual/en/function.error-reporting.php for possible values)
parameters:
debug.error_handler.throw_at: -1
Using Tracy\Debugger::dump
To prevent forgotten dumps to appear on production you can simply change the mode like this:
// AppKernel.php
use Tracy\Debugger;
public function __construct($environment, $debug)
{
Debugger::$productionMode = $environment === 'prod';
parent::__construct($environment, $debug);
}