lumen 自定义 log 存储路径 logrotate log轮转方式 log输出格式 log format

* .env

LOG_CHANNEL=daily
LOG_SLACK_WEBHOOK_URL=
LOG_PATH=/storage/logs/lumen.log
LOG_MAXFILE=5

 

* 参照 pearl/lumen-log-rotate
 创建文件 .\app\Providers\LogRotateServiceProvider.php

setFormatter(new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n", null, true, true));

        $this->app['log']->setHandlers($handlers);
    }
}
?>

* 注册服务

.\bootstrap\app.php
+1 line:

$app->register(App\Providers\LogRotateServiceProvider::class);

 

 

 

 

你可能感兴趣的:(php,环境配置,php,lumen,log,logrotate,service)