From 2a38605545e26ce68a37e5ebb877fd9c9875a37d Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 17 Jan 2018 15:21:56 +0100 Subject: Properly log the full exception instead of only the message Signed-off-by: Morris Jobke --- lib/private/Preview/Bitmap.php | 6 +++++- lib/private/Preview/Office.php | 5 ++++- lib/private/Preview/SVG.php | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'lib/private/Preview') diff --git a/lib/private/Preview/Bitmap.php b/lib/private/Preview/Bitmap.php index a375717480a..ff6093fcf81 100644 --- a/lib/private/Preview/Bitmap.php +++ b/lib/private/Preview/Bitmap.php @@ -48,7 +48,11 @@ abstract class Bitmap extends Provider { try { $bp = $this->getResizedPreview($tmpPath, $maxX, $maxY); } catch (\Exception $e) { - \OCP\Util::writeLog('core', 'ImageMagick says: ' . $e->getMessage(), \OCP\Util::ERROR); + \OC::$server->getLogger()->logException($e, [ + 'message' => 'Imagick says:', + 'level' => \OCP\Util::ERROR, + 'app' => 'core', + ]); return false; } diff --git a/lib/private/Preview/Office.php b/lib/private/Preview/Office.php index 2ec677c04fe..6403cf5dd8d 100644 --- a/lib/private/Preview/Office.php +++ b/lib/private/Preview/Office.php @@ -59,7 +59,10 @@ abstract class Office extends Provider { } catch (\Exception $e) { unlink($absPath); unlink($pdfPreview); - \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR); + \OC::$server->getLogger()->logException($e, [ + 'level' => \OCP\Util::ERROR, + 'app' => 'core', + ]); return false; } diff --git a/lib/private/Preview/SVG.php b/lib/private/Preview/SVG.php index 0695c251c8b..e0abf04d931 100644 --- a/lib/private/Preview/SVG.php +++ b/lib/private/Preview/SVG.php @@ -53,7 +53,10 @@ class SVG extends Provider { $svg->readImageBlob($content); $svg->setImageFormat('png32'); } catch (\Exception $e) { - \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR); + \OC::$server->getLogger()->logException($e, [ + 'level' => \OCP\Util::ERROR, + 'app' => 'core', + ]); return false; } -- cgit v1.2.3