summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-06-29 11:22:17 +0200
committerGitHub <noreply@github.com>2017-06-29 11:22:17 +0200
commit4a9277d8da12efa3abf03cc92c17dfa4ca964160 (patch)
treed66800992151d0abba40409de2d6f3e4069d1449 /lib/private
parente0ef9608489b896b61c5ef9bf897a9e95a6c9906 (diff)
parent0a12b5d38d8b5fe23c6f5480b4802522502f07d7 (diff)
downloadnextcloud-server-4a9277d8da12efa3abf03cc92c17dfa4ca964160.tar.gz
nextcloud-server-4a9277d8da12efa3abf03cc92c17dfa4ca964160.zip
Merge pull request #5460 from nextcloud/objectstore-error-logging
improved logging of objectore errors
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php26
1 files changed, 21 insertions, 5 deletions
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index ab77c21e6c4..ded69e8079b 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -46,6 +46,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
private $objectPrefix = 'urn:oid:';
+ private $logger;
+
public function __construct($params) {
if (isset($params['objectstore']) && $params['objectstore'] instanceof IObjectStore) {
$this->objectStore = $params['objectstore'];
@@ -64,6 +66,8 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
if (!$this->is_dir('/')) {
$this->mkdir('/');
}
+
+ $this->logger = \OC::$server->getLogger();
}
public function mkdir($path) {
@@ -185,7 +189,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
$this->objectStore->deleteObject($this->getURN($stat['fileid']));
} catch (\Exception $ex) {
if ($ex->getCode() !== 404) {
- \OCP\Util::writeLog('objectstore', 'Could not delete object: ' . $ex->getMessage(), \OCP\Util::ERROR);
+ $this->logger->logException($ex, [
+ 'app' => 'objectstore',
+ 'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path,
+ ]);
return false;
} else {
//removing from cache is ok as it does not exist in the objectstore anyway
@@ -234,7 +241,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
return IteratorDirectory::wrap($files);
} catch (\Exception $e) {
- \OCP\Util::writeLog('objectstore', $e->getMessage(), \OCP\Util::ERROR);
+ $this->logger->logException($e);
return false;
}
}
@@ -263,7 +270,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
try {
return $this->objectStore->readObject($this->getURN($stat['fileid']));
} catch (\Exception $ex) {
- \OCP\Util::writeLog('objectstore', 'Could not get object: ' . $ex->getMessage(), \OCP\Util::ERROR);
+ $this->logger->logException($ex, [
+ 'app' => 'objectstore',
+ 'message' => 'Count not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
+ ]);
return false;
}
} else {
@@ -357,7 +367,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
$this->objectStore->writeObject($this->getURN($fileId), fopen('php://memory', 'r'));
} catch (\Exception $ex) {
$this->getCache()->remove($path);
- \OCP\Util::writeLog('objectstore', 'Could not create object: ' . $ex->getMessage(), \OCP\Util::ERROR);
+ $this->logger->logException($ex, [
+ 'app' => 'objectstore',
+ 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path,
+ ]);
return false;
}
}
@@ -386,7 +399,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
$this->objectStore->writeObject($this->getURN($fileId), fopen($tmpFile, 'r'));
} catch (\Exception $ex) {
$this->getCache()->remove($path);
- \OCP\Util::writeLog('objectstore', 'Could not create object: ' . $ex->getMessage(), \OCP\Util::ERROR);
+ $this->logger->logException($ex, [
+ 'app' => 'objectstore',
+ 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path,
+ ]);
throw $ex; // make this bubble up
}
}