From 2b2968bca5b1c2e4d12053ecfbc8ed2e946c408e Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 3 Dec 2017 17:01:55 +0000 Subject: [PATCH] Smarter monolog integration. Fixes #2823 --- .../Controllers/Dashboard/SettingsController.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Dashboard/SettingsController.php b/app/Http/Controllers/Dashboard/SettingsController.php index 899501b0aa07..a6c3cc7cf0dc 100644 --- a/app/Http/Controllers/Dashboard/SettingsController.php +++ b/app/Http/Controllers/Dashboard/SettingsController.php @@ -27,6 +27,7 @@ use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\View; use Illuminate\Support\Str; +use Monolog\Handler\SyslogHandler; class SettingsController extends Controller { @@ -270,11 +271,15 @@ public function showLogView() $log = app(Writer::class)->getMonolog(); - if (file_exists($path = $log->getHandlers()[0]->getUrl())) { - $logContents = file_get_contents($path); - } else { - $logContents = ''; - } + $logContents = ''; + + collect($log->getHandlers())->reject(function ($handler) { + return $handler instanceof SyslogHandler; + })->each(function ($handler) use ($logContents) { + if (file_exists($path = $log->getHandlers()[0]->getUrl())) { + $logContents = file_get_contents($path); + } + }); return View::make('dashboard.settings.log')->withLog($logContents)->withSubMenu($this->subMenu); }