A free open source IT asset/license management system
Logging updates for 5.6
snipe3d3ed6ab03e9
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.phpindex fdceca3595..90f4c15fc5 100644--- a/app/Providers/AppServiceProvider.php+++ b/app/Providers/AppServiceProvider.php@@ -52,15 +52,10 @@ class AppServiceProvider extends ServiceProvider*/public function register(){- $monolog = Log::getMonolog();- $log_level = config('app.log_level');if (($this->app->environment('production')) && (config('services.rollbar.access_token'))){$this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);}- foreach ($monolog->getHandlers() as $handler) {- $handler->setLevel($log_level);- }}}diff --git a/config/app.php b/config/app.phpindex 1ff1661d76..3d66ad6a6c 100755--- a/config/app.php+++ b/config/app.php@@ -117,54 +117,6 @@ return ['cipher' => env('APP_CIPHER', 'AES-256-CBC'),- /*- |--------------------------------------------------------------------------- | Logging Configuration- |--------------------------------------------------------------------------- |- | Here you may configure the log settings for your application. Out of- | the box, Laravel uses the Monolog PHP logging library. This gives- | you a variety of powerful log handlers / formatters to utilize.- |- | Available Settings: "single", "daily", "syslog", "errorlog"- |- */-- 'log' => env('APP_LOG', 'single'),-- /*- |--------------------------------------------------------------------------- | Logging Max Files- |--------------------------------------------------------------------------- |- | When using the daily log mode, Laravel will only retain 5- | days of log files by default.- |- | To change this, set the APP_LOG_MAX_FILES option in your .env.- |- */-- 'log_max_files' => env('APP_LOG_MAX_FILES', 5),-- /*- |--------------------------------------------------------------------------- | Logging Detail- |--------------------------------------------------------------------------- |- | By default, Laravel writes all log levels to storage. However, in your- | production environment, you may wish to configure the minimum severity that- | should be logged by editing your APP_LOG_LEVEL env config.- |- | Laravel will log all levels greater than or equal to the specified severity.- | For example, a default log_level of error will log error, critical, alert,- | and emergency messages.- |- | APP_LOG_LEVEL options are:- | "debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"- |- */-- 'log_level' => env('APP_LOG_LEVEL', 'error'),/*diff --git a/config/logging.php b/config/logging.phpnew file mode 100644index 0000000000..c3b0a19556--- /dev/null+++ b/config/logging.php@@ -0,0 +1,81 @@+<?php++use Monolog\Handler\StreamHandler;++return [++ /*+ |--------------------------------------------------------------------------+ | Default Log Channel+ |--------------------------------------------------------------------------+ |+ | This option defines the default log channel that gets used when writing+ | messages to the logs. The name specified in this option should match+ | one of the channels defined in the "channels" configuration array.+ |+ */++ 'default' => env('LOG_CHANNEL', 'stack'),++ /*+ |--------------------------------------------------------------------------+ | Log Channels+ |--------------------------------------------------------------------------+ |+ | Here you may configure the log channels for your application. Out of+ | the box, Laravel uses the Monolog PHP logging library. This gives+ | you a variety of powerful log handlers / formatters to utilize.+ |+ | Available Drivers: "single", "daily", "slack", "syslog",+ | "errorlog", "monolog",+ | "custom", "stack"+ |+ */++ 'channels' => [+ 'stack' => [+ 'driver' => 'stack',+ 'channels' => ['single'],+ ],++ 'single' => [+ 'driver' => 'single',+ 'path' => storage_path('logs/laravel.log'),+ 'level' => 'debug',+ ],++ 'daily' => [+ 'driver' => 'daily',+ 'path' => storage_path('logs/laravel.log'),+ 'level' => 'debug',+ 'days' => env('APP_LOG_MAX_FILES', 5),+ ],++ 'slack' => [+ 'driver' => 'slack',+ 'url' => env('LOG_SLACK_WEBHOOK_URL'),+ 'username' => 'Laravel Log',+ 'emoji' => ':boom:',+ 'level' => 'critical',+ ],++ 'stderr' => [+ 'driver' => 'monolog',+ 'handler' => StreamHandler::class,+ 'with' => [+ 'stream' => 'php://stderr',+ ],+ ],++ 'syslog' => [+ 'driver' => 'syslog',+ 'level' => env('APP_LOG_LEVEL', 'error'),+ ],++ 'errorlog' => [+ 'driver' => 'errorlog',+ 'level' => env('APP_LOG_LEVEL', 'error'),+ ],+ ],++];