diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-01-23 11:56:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-23 11:56:02 +0100 |
commit | 4537faa5dabdcb2f0b888baa5031e59099e52d6a (patch) | |
tree | 0295177ddd5f6736739c503131eb75323561b220 /lib/private/Files | |
parent | 9cb3a79b18bb74e3f79d53aa400d7efa5b2c2174 (diff) | |
parent | 2a38605545e26ce68a37e5ebb877fd9c9875a37d (diff) | |
download | nextcloud-server-4537faa5dabdcb2f0b888baa5031e59099e52d6a.tar.gz nextcloud-server-4537faa5dabdcb2f0b888baa5031e59099e52d6a.zip |
Merge pull request #7918 from nextcloud/properly-log-exceptions
Properly log the full exception instead of only the message
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(''); |