diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-17 15:21:56 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-23 10:57:21 +0100 |
commit | 2a38605545e26ce68a37e5ebb877fd9c9875a37d (patch) | |
tree | a149433f3fdeae3b4615061b495e4c523328a9a6 /lib/private/Files | |
parent | 520f2fd6ea3661d5d49517c7265dd8d7515036ac (diff) | |
download | nextcloud-server-2a38605545e26ce68a37e5ebb877fd9c9875a37d.tar.gz nextcloud-server-2a38605545e26ce68a37e5ebb877fd9c9875a37d.zip |
Properly log the full exception instead of only the message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 6 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/DAV.php | 3 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 7 | ||||
-rw-r--r-- | lib/private/Files/View.php | 11 |
5 files changed, 21 insertions, 12 deletions
diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 85a89962f76..28a3d11ffa9 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -452,7 +452,11 @@ class Scanner extends BasicEmitter implements IScanner { \OC::$server->getDatabaseConnection()->rollback(); \OC::$server->getDatabaseConnection()->beginTransaction(); } - \OCP\Util::writeLog('core', 'Exception while scanning file "' . $child . '": ' . $ex->getMessage(), \OCP\Util::DEBUG); + \OC::$server->getLogger()->logException($ex, [ + 'message' => 'Exception while scanning file "' . $child . '"', + 'level' => \OCP\Util::DEBUG, + 'app' => 'core', + ]); $exceptionOccurred = true; } catch (\OCP\Lock\LockedException $e) { if ($this->useTransactions) { diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index d4910834962..7e70cc846ef 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -109,7 +109,11 @@ trait S3ConnectionTrait { )); $this->testTimeout(); } catch (S3Exception $e) { - \OCP\Util::logException('files_external', $e); + \OC::$server->getLogger()->logException($e, [ + 'message' => 'Invalid remote storage.', + 'level' => \OCP\Util::DEBUG, + 'app' => 'files_external', + ]); throw new \Exception('Creation of bucket failed. ' . $e->getMessage()); } } diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 6585dd862e4..43347aa0b8f 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -830,8 +830,7 @@ class DAV extends Common { * which might be temporary */ protected function convertException(Exception $e, $path = '') { - \OC::$server->getLogger()->logException($e); - Util::writeLog('files_external', $e->getMessage(), Util::ERROR); + \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); if ($e instanceof ClientHttpException) { if ($e->getHttpStatus() === Http::STATUS_LOCKED) { throw new \OCP\Lock\LockedException($path); diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 1ca750f0024..d443ccfd49b 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -441,8 +441,11 @@ class Encryption extends Wrapper { } } } catch (ModuleDoesNotExistsException $e) { - $this->logger->warning('Encryption module "' . $encryptionModuleId . - '" not found, file will be stored unencrypted (' . $e->getMessage() . ')'); + $this->logger->logException($e, [ + 'message' => 'Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted', + 'level' => \OCP\Util::WARN, + 'app' => 'core', + ]); } // encryption disabled on write of new file and write to existing unencrypted file -> don't encrypt diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 592d4b717ce..fb0b116666e 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1464,12 +1464,11 @@ class View { continue; } catch (\Exception $e) { // sometimes when the storage is not available it can be any exception - \OCP\Util::writeLog( - 'core', - 'Exception while scanning storage "' . $subStorage->getId() . '": ' . - get_class($e) . ': ' . $e->getMessage(), - \OCP\Util::ERROR - ); + \OC::$server->getLogger()->logException($e, [ + 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"', + 'level' => \OCP\Util::ERROR, + 'app' => 'lib', + ]); continue; } $rootEntry = $subCache->get(''); |