aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Command
diff options
context:
space:
mode:
authorAri Selseng <ari@selseng.net>2019-03-04 13:54:52 +0100
committerAri Selseng <ari@selseng.net>2019-03-04 14:23:13 +0100
commit3218e0f70de6ad5b4ec6de00f693b2bbbd22f9d7 (patch)
tree493046696b4e513926e6f10a5b2141a046c06626 /apps/files_external/lib/Command
parent71a0cdceaaad76cd08f48c28d3da40d7fc8d2abf (diff)
downloadnextcloud-server-3218e0f70de6ad5b4ec6de00f693b2bbbd22f9d7.tar.gz
nextcloud-server-3218e0f70de6ad5b4ec6de00f693b2bbbd22f9d7.zip
Added logging to Notify command.
Signed-off-by: Ari Selseng <ari@selseng.net>
Diffstat (limited to 'apps/files_external/lib/Command')
-rw-r--r--apps/files_external/lib/Command/Notify.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/files_external/lib/Command/Notify.php b/apps/files_external/lib/Command/Notify.php
index a0b116f07d9..e3ec2e874ae 100644
--- a/apps/files_external/lib/Command/Notify.php
+++ b/apps/files_external/lib/Command/Notify.php
@@ -37,6 +37,7 @@ use OCP\Files\Storage\INotifyStorage;
use OCP\Files\Storage\IStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\IDBConnection;
+use OCP\ILogger;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -49,11 +50,14 @@ class Notify extends Base {
private $connection;
/** @var \OCP\DB\QueryBuilder\IQueryBuilder */
private $updateQuery;
+ /** @var ILogger */
+ private $log;
- function __construct(GlobalStoragesService $globalService, IDBConnection $connection) {
+ function __construct(GlobalStoragesService $globalService, IDBConnection $connection, ILogger $logger) {
parent::__construct();
$this->globalService = $globalService;
$this->connection = $connection;
+ $this->logger = $logger;
$this->updateQuery = $this->getUpdateQuery($this->connection);
}
@@ -159,7 +163,8 @@ class Notify extends Base {
try {
$this->updateQuery->execute([$parent, $mountId]);
- } catch (DriverException $th) {
+ } catch (DriverException $ex) {
+ $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while trying to mark folder as outdated', 'level' => ILogger::WARN]);
$this->connection = $this->reconnectToDatabase($this->connection, $output);
$output->writeln('<info>Needed to reconnect to the database</info>');
$this->updateQuery = $this->getUpdateQuery($this->connection);
@@ -212,12 +217,14 @@ class Notify extends Base {
try {
$connection->close();
} catch (\Exception $ex) {
+ $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while disconnecting from DB', 'level' => ILogger::WARN]);
$output->writeln("<info>Error while disconnecting from database: {$ex->getMessage()}</info>");
}
while (!$connection->isConnected()) {
try {
$connection->connect();
} catch (\Exception $ex) {
+ $this->logger->logException($ex, ['app' => 'files_external', 'message' => 'Error while re-connecting to database', 'level' => ILogger::WARN]);
$output->writeln("<info>Error while re-connecting to database: {$ex->getMessage()}</info>");
sleep(60);
}