Add more logging for the object storage during creation of the buckets

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2018-04-05 17:26:09 +02:00
parent a3a66859d3
commit 2f068bc9d1
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
1 changed files with 5 additions and 3 deletions

View File

@ -103,18 +103,20 @@ trait S3ConnectionTrait {
} }
if (!$this->connection->doesBucketExist($this->bucket)) { if (!$this->connection->doesBucketExist($this->bucket)) {
$logger = \OC::$server->getLogger();
try { try {
$logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']);
$this->connection->createBucket(array( $this->connection->createBucket(array(
'Bucket' => $this->bucket 'Bucket' => $this->bucket
)); ));
$this->testTimeout(); $this->testTimeout();
} catch (S3Exception $e) { } catch (S3Exception $e) {
\OC::$server->getLogger()->logException($e, [ $logger->logException($e, [
'message' => 'Invalid remote storage.', 'message' => 'Invalid remote storage.',
'level' => \OCP\Util::DEBUG, 'level' => \OCP\Util::DEBUG,
'app' => 'files_external', 'app' => 'objectstore',
]); ]);
throw new \Exception('Creation of bucket failed. ' . $e->getMessage()); throw new \Exception('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage());
} }
} }