Last active
July 20, 2019 07:55
-
-
Save briceburg/77e97d90b1073c7622cb to your computer and use it in GitHub Desktop.
laravel 5 - configuring minimal log level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/config/app.php | |
return [ | |
// .... | |
'log-level' => 'info', | |
'log' => 'errorlog', | |
]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Log; | |
use Config; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Bootstrap any application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
// | |
} | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
$monolog = Log::getMonolog(); | |
foreach($monolog->getHandlers() as $handler) { | |
$handler->setLevel(Config::get('app.log-level')); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a global change. What should I do if error.log or just output error information