Skip to content

Instantly share code, notes, and snippets.

@briceburg
Last active July 20, 2019 07:55
Show Gist options
  • Save briceburg/77e97d90b1073c7622cb to your computer and use it in GitHub Desktop.
Save briceburg/77e97d90b1073c7622cb to your computer and use it in GitHub Desktop.
laravel 5 - configuring minimal log level
<?php
// app/config/app.php
return [
// ....
'log-level' => 'info',
'log' => 'errorlog',
];
<?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'));
}
}
}
@glorityZxy
Copy link

这个是全局的修改 如果error.log 还是只输出error的信息 我应该怎么做呢

@glorityZxy
Copy link

This is a global change. What should I do if error.log or just output error information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment