Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/dav/lib/Connector/Sabre/ExceptionLoggerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ public function initialize(\Sabre\DAV\Server $server) {
*/
public function logException(\Exception $ex) {
$exceptionClass = get_class($ex);
$level = \OCP\Util::FATAL;
$level = ILogger::FATAL;
if (isset($this->nonFatalExceptions[$exceptionClass]) ||
(
$exceptionClass === ServiceUnavailable::class &&
$ex->getMessage() === 'System in maintenance mode.'
)
) {
$level = \OCP\Util::DEBUG;
$level = ILogger::DEBUG;
}

$this->logger->logException($ex, [
Expand Down
2 changes: 1 addition & 1 deletion apps/encryption/lib/KeyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public function init($uid, $passPhrase) {
} catch (\Exception $e) {
$this->log->logException($e, [
'message' => 'Could not decrypt the private key from user "' . $uid . '"" during login. Assume password change on the user back-end.',
'level' => \OCP\Util::WARN,
'level' => ILogger::WARN,
'app' => 'encryption',
]);
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
use OCP\Files\StorageInvalidException;
use OCP\Http\Client\IClientService;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\IUserSession;
Expand Down Expand Up @@ -165,7 +166,7 @@ public function createFederatedShare($shareWith, $token, $password = '') {
$this->federatedShareProvider->create($share);
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::WARN,
'level' => ILogger::WARN,
'app' => 'federatedfilesharing',
]);
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function createShare() {
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Server can not add remote share.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_sharing'
]);
throw new OCSException('internal server error, was not able to add share from ' . $remote, 500);
Expand Down
2 changes: 1 addition & 1 deletion apps/federatedfilesharing/lib/FederatedShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ protected function createFederatedShare(IShare $share) {
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Failed to notify remote server of federated share, removing share.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'federatedfilesharing',
]);
$failure = true;
Expand Down
4 changes: 2 additions & 2 deletions apps/federation/lib/BackgroundJob/GetSharedSecret.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ protected function run($argument) {
$status = -1; // There is no status code if we could not connect
$this->logger->logException($e, [
'message' => 'Could not connect to ' . $target,
'level' => \OCP\Util::INFO,
'level' => ILogger::INFO,
'app' => 'federation',
]);
} catch (RingException $e) {
$status = -1; // There is no status code if we could not connect
$this->logger->logException($e, [
'message' => 'Could not connect to ' . $target,
'level' => \OCP\Util::INFO,
'level' => ILogger::INFO,
'app' => 'federation',
]);
} catch (\Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/Middleware/AddServerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function afterException($controller, $methodName, \Exception $exception)
throw $exception;
}
$this->logger->logException($exception, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => $this->appName,
]);
if ($exception instanceof HintException) {
Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/SyncJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected function run($argument) {
if ($ex instanceof \Exception) {
$this->logger->logException($ex, [
'message' => "Error while syncing $url.",
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'fed-sync',
]);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/federation/lib/TrustedServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function isOwnCloudServer($url) {
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'message' => 'No Nextcloud server.',
'level' => \OCP\Util::DEBUG,
'level' => ILogger::DEBUG,
'app' => 'federation',
]);
return false;
Expand Down
3 changes: 2 additions & 1 deletion apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
use OCP\Files\Notify\IRenameChange;
use OCP\Files\Storage\INotifyStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\ILogger;
use OCP\Util;

class SMB extends Common implements INotifyStorage {
Expand Down Expand Up @@ -202,7 +203,7 @@ public function rename($source, $target) {
$this->remove($target);
$result = $this->share->rename($absoluteSource, $absoluteTarget);
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, ['level' => Util::WARN]);
\OC::$server->getLogger()->logException($e, ['level' => ILogger::WARN]);
return false;
}
unset($this->statCache[$absoluteSource], $this->statCache[$absoluteTarget]);
Expand Down
19 changes: 10 additions & 9 deletions apps/files_external/lib/Lib/Storage/Swift.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
use Icewind\Streams\IteratorDirectory;
use OC\Files\ObjectStore\SwiftFactory;
use OCP\Files\StorageBadConfigException;
use OCP\ILogger;
use OpenStack\Common\Error\BadResponseError;
use OpenStack\ObjectStore\v1\Models\StorageObject;

Expand Down Expand Up @@ -132,7 +133,7 @@ private function fetchObject(string $path) {
// Expected response is "404 Not Found", so only log if it isn't
if ($e->getResponse()->getStatusCode() !== 404) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
}
Expand Down Expand Up @@ -225,7 +226,7 @@ public function mkdir($path) {
$this->objectCache->remove($path);
} catch (BadResponseError $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand Down Expand Up @@ -269,7 +270,7 @@ public function rmdir($path) {
$this->objectCache->remove($path . '/');
} catch (BadResponseError $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand Down Expand Up @@ -307,7 +308,7 @@ public function opendir($path) {
return IteratorDirectory::wrap($files);
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand All @@ -331,7 +332,7 @@ public function stat($path) {
}
} catch (BadResponseError $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand Down Expand Up @@ -385,7 +386,7 @@ public function unlink($path) {
} catch (BadResponseError $e) {
if ($e->getResponse()->getStatusCode() !== 404) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
throw $e;
Expand All @@ -409,7 +410,7 @@ public function fopen($path, $mode) {
return $this->objectStore->readObject($path);
} catch (BadResponseError $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand Down Expand Up @@ -496,7 +497,7 @@ public function copy($path1, $path2) {
$this->objectCache->remove($path2 . '/');
} catch (BadResponseError $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand All @@ -513,7 +514,7 @@ public function copy($path1, $path2) {
$this->objectCache->remove($path2 . '/');
} catch (BadResponseError $e) {
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return false;
Expand Down
3 changes: 2 additions & 1 deletion apps/files_external/lib/Service/LegacyStoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
namespace OCA\Files_External\Service;

use OCA\Files_External\Lib\StorageConfig;
use OCP\ILogger;

/**
* Read mount config from legacy mount.json
Expand Down Expand Up @@ -190,7 +191,7 @@ public function getAllStorages() {
// don't die if a storage backend doesn't exist
\OC::$server->getLogger()->logException($e, [
'message' => 'Could not load storage.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
}
Expand Down
7 changes: 4 additions & 3 deletions apps/files_external/lib/Service/StoragesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use \OCA\Files_External\Lib\Auth\AuthMechanism;
use OCP\Files\Config\IUserMountCache;
use \OCP\Files\StorageNotAvailableException;
use OCP\ILogger;

/**
* Service class to manage external storages
Expand Down Expand Up @@ -104,14 +105,14 @@ protected function getStorageConfigFromDBMount(array $mount) {
// don't die if a storage backend doesn't exist
\OC::$server->getLogger()->logException($e, [
'message' => 'Could not load storage.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return null;
} catch (\InvalidArgumentException $e) {
\OC::$server->getLogger()->logException($e, [
'message' => 'Could not load storage.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
return null;
Expand Down Expand Up @@ -479,7 +480,7 @@ public function removeStorage($id) {
// be instantiated or whenever $user vars where used, in which case
// the storage id could not be computed
\OC::$server->getLogger()->logException($e, [
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'files_external',
]);
}
Expand Down
5 changes: 4 additions & 1 deletion apps/files_trashbin/ajax/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

use OCP\ILogger;

\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
\OC::$server->getSession()->close();
Expand Down Expand Up @@ -66,7 +69,7 @@
OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp);
if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
$error[] = $filename;
\OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', \OCP\Util::ERROR);
\OCP\Util::writeLog('trashbin','can\'t delete ' . $filename . ' permanently.', ILogger::ERROR);
}
// only list deleted files if not deleting everything
else if (!$deleteAll) {
Expand Down
5 changes: 4 additions & 1 deletion apps/files_trashbin/ajax/undelete.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/

use OCP\ILogger;

\OC_JSON::checkLoggedIn();
\OC_JSON::callCheck();
\OC::$server->getSession()->close();
Expand Down Expand Up @@ -72,7 +75,7 @@

if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) {
$error[] = $filename;
\OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, \OCP\Util::ERROR);
\OCP\Util::writeLog('trashbin', 'can\'t restore ' . $filename, ILogger::ERROR);
} else {
$success[$i]['filename'] = $file;
$success[$i]['timestamp'] = $timestamp;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_trashbin/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static function preRenameHook($params) {
// do nothing, in this case we just disable the trashbin and continue
\OC::$server->getLogger()->logException($e, [
'message' => 'Trashbin storage could not check if a file was moved out of a shared folder.',
'level' => \OCP\Util::DEBUG,
'level' => ILogger::DEBUG,
'app' => 'files_trashbin',
]);
}
Expand Down
8 changes: 4 additions & 4 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function addUser(string $userid,
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => "Can't send new user mail to $email",
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'ocs_api',
]);
throw new OCSException('Unable to send the invitation mail', 109);
Expand All @@ -306,14 +306,14 @@ public function addUser(string $userid,
} catch (HintException $e ) {
$this->logger->logException($e, [
'message' => 'Failed addUser attempt with hint exception.',
'level' => \OCP\Util::WARN,
'level' => ILogger::WARN,
'app' => 'ocs_api',
]);
throw new OCSException($e->getHint(), 107);
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Failed addUser attempt with exception.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'ocs_api',
]);
throw new OCSException('Bad request', 101);
Expand Down Expand Up @@ -885,7 +885,7 @@ public function resendWelcomeMessage(string $userId): DataResponse {
} catch(\Exception $e) {
$this->logger->logException($e, [
'message' => "Can't send new user mail to $email",
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'settings',
]);
throw new OCSException('Sending email failed', 102);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ public function testAddUserUnsuccessful() {
->method('logException')
->with($exception, [
'message' => 'Failed addUser attempt with exception.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'ocs_api',
]);
$loggedInUser = $this->getMockBuilder(IUser::class)
Expand Down
4 changes: 2 additions & 2 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ protected function createMailShare(IShare $share) {
} catch (HintException $hintException) {
$this->logger->logException($hintException, [
'message' => 'Failed to send share by mail.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'sharebymail',
]);
$this->removeShareFromTable($shareId);
throw $hintException;
} catch (\Exception $e) {
$this->logger->logException($e, [
'message' => 'Failed to send share by mail.',
'level' => \OCP\Util::ERROR,
'level' => ILogger::ERROR,
'app' => 'sharebymail',
]);
$this->removeShareFromTable($shareId);
Expand Down
Loading