From acdf51decae03b2de136d8bbda3fc9beb65884bb Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Sat, 9 Apr 2022 14:21:10 -0500 Subject: [PATCH] Print full error message in poller/discovery output (#13903) It was previously missing the file and line number the error occurred on. Only showing the error message and stack trace before. --- LibreNMS/Poller.php | 2 +- includes/discovery/functions.inc.php | 2 +- includes/polling/functions.inc.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LibreNMS/Poller.php b/LibreNMS/Poller.php index b5ab8d0568..b936da22d1 100644 --- a/LibreNMS/Poller.php +++ b/LibreNMS/Poller.php @@ -180,7 +180,7 @@ class Poller $instance->poll($this->os); } catch (Throwable $e) { // isolate module exceptions so they don't disrupt the polling process - $this->logger->error("%rError polling $module module for {$this->device->hostname}.%n " . $e->getMessage() . PHP_EOL . $e->getTraceAsString(), ['color' => true]); + $this->logger->error("%rError polling $module module for {$this->device->hostname}.%n $e", ['color' => true]); \Log::event("Error polling $module module. Check log file for more details.", $this->device, 'poller', Alert::ERROR); } diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index e441949be7..f4b239089d 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -157,7 +157,7 @@ function discover_device(&$device, $force_module = false) include "includes/discovery/$module.inc.php"; } catch (Throwable $e) { // isolate module exceptions so they don't disrupt the polling process - Log::error("%rError discovering $module module for {$device['hostname']}.%n " . $e->getMessage() . PHP_EOL . $e->getTraceAsString(), ['color' => true]); + Log::error("%rError discovering $module module for {$device['hostname']}.%n $e", ['color' => true]); Log::event("Error discovering $module module. Check log file for more details.", $device['device_id'], 'discovery', Alert::ERROR); } diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index 1c0415f2b2..e996cbd3c1 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -329,7 +329,7 @@ function poll_device($device, $force_module = false) include "includes/polling/$module.inc.php"; } catch (Throwable $e) { // isolate module exceptions so they don't disrupt the polling process - Log::error("%rError polling $module module for {$device['hostname']}.%n " . $e->getMessage() . PHP_EOL . $e->getTraceAsString(), ['color' => true]); + Log::error("%rError polling $module module for {$device['hostname']}.%n $e", ['color' => true]); Log::event("Error polling $module module. Check log file for more details.", $device['device_id'], 'poller', Alert::ERROR); }