emirsator / monolog-mysql
Laravel 5 MySQL driver for Monolog
2.1.0
2018-07-22 20:19 UTC
Requires
- php: >=5.5.9
- webpatser/laravel-uuid: ^2.2
README
This package will log errors into MySQL database instead storage/log/laravel.log file.
Installation
composer require emirsator/monolog-mysql
Open up config/app.php
and find the providers
key.
'providers' => array(
// ...
Logger\Laravel\Provider\MonologMysqlHandlerServiceProvider::class,
);
Publish config using Laravel Artisan CLI.
php artisan vendor:publish
Migrate tables.
php artisan migrate
Application Integration
In your application bootstrap/app.php
add:
$app->configureMonologUsing(function($monolog) use($app) { $monolog->pushHandler(new Logger\Monolog\Handler\MysqlHandler()); });
Environment configuration
If you wish to change default table name to write the log into or database connection use following definitions in your .env file
DB_LOG_TABLE=logs
DB_LOG_CONNECTION=mysql
Credits
Based on:
- [Mark Hilton] (https://github.com/markhilton/monolog-mysql)