summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/lib/KeyManager.php10
-rw-r--r--apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php44
-rw-r--r--apps/federatedfilesharing/lib/Controller/RequestHandlerController.php6
-rw-r--r--apps/federatedfilesharing/lib/FederatedShareProvider.php6
-rw-r--r--apps/federation/lib/BackgroundJob/GetSharedSecret.php12
-rw-r--r--apps/federation/lib/Middleware/AddServerMiddleware.php5
-rw-r--r--apps/federation/lib/SyncJob.php6
-rw-r--r--apps/federation/lib/TrustedServers.php6
-rw-r--r--apps/federation/tests/Middleware/AddServerMiddlewareTest.php10
-rw-r--r--apps/files_external/lib/Lib/Storage/Swift.php45
-rw-r--r--apps/files_external/lib/Service/LegacyStoragesService.php10
-rw-r--r--apps/files_external/lib/Service/StoragesService.php29
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php8
-rw-r--r--apps/files_trashbin/lib/Storage.php7
-rw-r--r--apps/provisioning_api/lib/Controller/UsersController.php12
-rw-r--r--apps/provisioning_api/tests/Controller/UsersControllerTest.php11
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php12
-rw-r--r--apps/user_ldap/lib/User/User.php8
18 files changed, 164 insertions, 83 deletions
diff --git a/apps/encryption/lib/KeyManager.php b/apps/encryption/lib/KeyManager.php
index d25a25cdcb8..e52da123fe0 100644
--- a/apps/encryption/lib/KeyManager.php
+++ b/apps/encryption/lib/KeyManager.php
@@ -372,11 +372,11 @@ class KeyManager {
} catch (DecryptionFailedException $e) {
return false;
} catch (\Exception $e) {
- $this->log->warning(
- 'Could not decrypt the private key from user "' . $uid . '"" during login. ' .
- 'Assume password change on the user back-end. Error message: '
- . $e->getMessage()
- );
+ $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,
+ 'app' => 'encryption',
+ ]);
return false;
}
diff --git a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
index 19f98b264e6..a54a3aa69a0 100644
--- a/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
+++ b/apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php
@@ -164,6 +164,10 @@ class MountPublicLinkController extends Controller {
try {
$this->federatedShareProvider->create($share);
} catch (\Exception $e) {
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::WARN,
+ 'app' => 'federatedfilesharing',
+ ]);
return new JSONResponse(['message' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
}
@@ -286,18 +290,18 @@ class MountPublicLinkController extends Controller {
$storage->checkStorageAvailability();
} catch (StorageInvalidException $e) {
// note: checkStorageAvailability will already remove the invalid share
- Util::writeLog(
- 'federatedfilesharing',
- 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
- Util::DEBUG
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Invalid remote storage.',
+ 'level' => \OCP\Util::DEBUG,
+ 'app' => 'federatedfilesharing'
+ ]);
return new JSONResponse(['message' => $this->l->t('Could not authenticate to remote share, password might be wrong')], Http::STATUS_BAD_REQUEST);
} catch (\Exception $e) {
- Util::writeLog(
- 'federatedfilesharing',
- 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
- Util::DEBUG
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Invalid remote storage.',
+ 'level' => \OCP\Util::DEBUG,
+ 'app' => 'federatedfilesharing'
+ ]);
$externalManager->removeShare($mount->getMountPoint());
return new JSONResponse(['message' => $this->l->t('Storage not valid')], Http::STATUS_BAD_REQUEST);
}
@@ -312,18 +316,18 @@ class MountPublicLinkController extends Controller {
]
);
} catch (StorageInvalidException $e) {
- Util::writeLog(
- 'federatedfilesharing',
- 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
- Util::DEBUG
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Invalid remote storage.',
+ 'level' => \OCP\Util::DEBUG,
+ 'app' => 'federatedfilesharing'
+ ]);
return new JSONResponse(['message' => $this->l->t('Storage not valid')], Http::STATUS_BAD_REQUEST);
} catch (\Exception $e) {
- Util::writeLog(
- 'federatedfilesharing',
- 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
- Util::DEBUG
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Invalid remote storage.',
+ 'level' => \OCP\Util::DEBUG,
+ 'app' => 'federatedfilesharing'
+ ]);
return new JSONResponse(['message' => $this->l->t('Couldn\'t add remote share')], Http::STATUS_BAD_REQUEST);
}
} else {
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
index a74342f1182..bc81db50b28 100644
--- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
+++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php
@@ -209,7 +209,11 @@ class RequestHandlerController extends OCSController {
return new Http\DataResponse();
} catch (\Exception $e) {
- \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Server can not add remote share.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_sharing'
+ ]);
throw new OCSException('internal server error, was not able to add share from ' . $remote, 500);
}
}
diff --git a/apps/federatedfilesharing/lib/FederatedShareProvider.php b/apps/federatedfilesharing/lib/FederatedShareProvider.php
index 27606c5fdec..1025c3c4ae7 100644
--- a/apps/federatedfilesharing/lib/FederatedShareProvider.php
+++ b/apps/federatedfilesharing/lib/FederatedShareProvider.php
@@ -264,7 +264,11 @@ class FederatedShareProvider implements IShareProvider {
$failure = true;
}
} catch (\Exception $e) {
- $this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')');
+ $this->logger->logException($e, [
+ 'message' => 'Failed to notify remote server of federated share, removing share.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'federatedfilesharing',
+ ]);
$failure = true;
}
diff --git a/apps/federation/lib/BackgroundJob/GetSharedSecret.php b/apps/federation/lib/BackgroundJob/GetSharedSecret.php
index 92bb31e369e..829e04ddb28 100644
--- a/apps/federation/lib/BackgroundJob/GetSharedSecret.php
+++ b/apps/federation/lib/BackgroundJob/GetSharedSecret.php
@@ -201,10 +201,18 @@ class GetSharedSecret extends Job {
}
} catch (RequestException $e) {
$status = -1; // There is no status code if we could not connect
- $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
+ $this->logger->logException($e, [
+ 'message' => 'Could not connect to ' . $target,
+ 'level' => \OCP\Util::INFO,
+ 'app' => 'federation',
+ ]);
} catch (RingException $e) {
$status = -1; // There is no status code if we could not connect
- $this->logger->info('Could not connect to ' . $target, ['app' => 'federation']);
+ $this->logger->logException($e, [
+ 'message' => 'Could not connect to ' . $target,
+ 'level' => \OCP\Util::INFO,
+ 'app' => 'federation',
+ ]);
} catch (\Exception $e) {
$status = Http::STATUS_INTERNAL_SERVER_ERROR;
$this->logger->logException($e, ['app' => 'federation']);
diff --git a/apps/federation/lib/Middleware/AddServerMiddleware.php b/apps/federation/lib/Middleware/AddServerMiddleware.php
index 247cc958833..c6ac42bd7c3 100644
--- a/apps/federation/lib/Middleware/AddServerMiddleware.php
+++ b/apps/federation/lib/Middleware/AddServerMiddleware.php
@@ -71,7 +71,10 @@ class AddServerMiddleware extends Middleware {
if (($controller instanceof SettingsController) === false) {
throw $exception;
}
- $this->logger->error($exception->getMessage(), ['app' => $this->appName]);
+ $this->logger->logException($exception, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => $this->appName,
+ ]);
if ($exception instanceof HintException) {
$message = $exception->getHint();
} else {
diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php
index 0aa1d61affb..23255f2a441 100644
--- a/apps/federation/lib/SyncJob.php
+++ b/apps/federation/lib/SyncJob.php
@@ -49,7 +49,11 @@ class SyncJob extends TimedJob {
protected function run($argument) {
$this->syncService->syncThemAll(function($url, $ex) {
if ($ex instanceof \Exception) {
- $this->logger->error("Error while syncing $url : " . $ex->getMessage(), ['app' => 'fed-sync']);
+ $this->logger->logException($ex, [
+ 'message' => "Error while syncing $url.",
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'fed-sync',
+ ]);
}
});
}
diff --git a/apps/federation/lib/TrustedServers.php b/apps/federation/lib/TrustedServers.php
index 79cf86ab67b..2067533c3e7 100644
--- a/apps/federation/lib/TrustedServers.php
+++ b/apps/federation/lib/TrustedServers.php
@@ -241,7 +241,11 @@ class TrustedServers {
}
} catch (\Exception $e) {
- $this->logger->debug('No Nextcloud server: ' . $e->getMessage());
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'No Nextcloud server.',
+ 'level' => \OCP\Util::DEBUG,
+ 'app' => 'federation',
+ ]);
return false;
}
diff --git a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
index 4620234d685..7bae5e566fc 100644
--- a/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
+++ b/apps/federation/tests/Middleware/AddServerMiddlewareTest.php
@@ -68,13 +68,11 @@ class AddServerMiddlewareTest extends TestCase {
* @dataProvider dataTestAfterException
*
* @param \Exception $exception
- * @param string $message
* @param string $hint
*/
- public function testAfterException($exception, $message, $hint) {
+ public function testAfterException($exception, $hint) {
- $this->logger->expects($this->once())->method('error')
- ->with($message, ['app' => 'AddServerMiddlewareTest']);
+ $this->logger->expects($this->once())->method('logException');
$this->l10n->expects($this->any())->method('t')
->willReturnCallback(
@@ -98,8 +96,8 @@ class AddServerMiddlewareTest extends TestCase {
public function dataTestAfterException() {
return [
- [new HintException('message', 'hint'), 'message', 'hint'],
- [new \Exception('message'), 'message', 'message'],
+ [new HintException('message', 'hint'), 'hint'],
+ [new \Exception('message'), 'message'],
];
}
diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php
index f07087e903d..aeedd3dcd63 100644
--- a/apps/files_external/lib/Lib/Storage/Swift.php
+++ b/apps/files_external/lib/Lib/Storage/Swift.php
@@ -138,7 +138,10 @@ class Swift extends \OC\Files\Storage\Common {
} catch (ClientErrorResponseException $e) {
// Expected response is "404 Not Found", so only log if it isn't
if ($e->getResponse()->getStatusCode() !== 404) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
}
return false;
}
@@ -206,7 +209,10 @@ class Swift extends \OC\Files\Storage\Common {
// with all properties
$this->objectCache->remove($path);
} catch (Exceptions\CreateUpdateError $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
@@ -247,7 +253,10 @@ class Swift extends \OC\Files\Storage\Common {
$this->getContainer()->dataObject()->setName($path . '/')->delete();
$this->objectCache->remove($path . '/');
} catch (Exceptions\DeleteError $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
@@ -283,7 +292,10 @@ class Swift extends \OC\Files\Storage\Common {
return IteratorDirectory::wrap($files);
} catch (\Exception $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
@@ -305,7 +317,10 @@ class Swift extends \OC\Files\Storage\Common {
return false;
}
} catch (ClientErrorResponseException $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
@@ -361,7 +376,10 @@ class Swift extends \OC\Files\Storage\Common {
$this->objectCache->remove($path . '/');
} catch (ClientErrorResponseException $e) {
if ($e->getResponse()->getStatusCode() !== 404) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
}
return false;
}
@@ -394,7 +412,10 @@ class Swift extends \OC\Files\Storage\Common {
}
return false;
} catch (\Guzzle\Http\Exception\BadResponseException $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
case 'w':
@@ -474,7 +495,10 @@ class Swift extends \OC\Files\Storage\Common {
$this->objectCache->remove($path2);
$this->objectCache->remove($path2 . '/');
} catch (ClientErrorResponseException $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
@@ -490,7 +514,10 @@ class Swift extends \OC\Files\Storage\Common {
$this->objectCache->remove($path2);
$this->objectCache->remove($path2 . '/');
} catch (ClientErrorResponseException $e) {
- \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return false;
}
diff --git a/apps/files_external/lib/Service/LegacyStoragesService.php b/apps/files_external/lib/Service/LegacyStoragesService.php
index 68faf0f2854..65880514911 100644
--- a/apps/files_external/lib/Service/LegacyStoragesService.php
+++ b/apps/files_external/lib/Service/LegacyStoragesService.php
@@ -192,11 +192,11 @@ abstract class LegacyStoragesService {
}
} catch (\UnexpectedValueException $e) {
// don't die if a storage backend doesn't exist
- \OCP\Util::writeLog(
- 'files_external',
- 'Could not load storage: "' . $e->getMessage() . '"',
- \OCP\Util::ERROR
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Could not load storage.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
}
}
}
diff --git a/apps/files_external/lib/Service/StoragesService.php b/apps/files_external/lib/Service/StoragesService.php
index d52bf410461..89458b70c0c 100644
--- a/apps/files_external/lib/Service/StoragesService.php
+++ b/apps/files_external/lib/Service/StoragesService.php
@@ -102,18 +102,18 @@ abstract class StoragesService {
return $config;
} catch (\UnexpectedValueException $e) {
// don't die if a storage backend doesn't exist
- \OCP\Util::writeLog(
- 'files_external',
- 'Could not load storage: "' . $e->getMessage() . '"',
- \OCP\Util::ERROR
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Could not load storage.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return null;
} catch (\InvalidArgumentException $e) {
- \OCP\Util::writeLog(
- 'files_external',
- 'Could not load storage: "' . $e->getMessage() . '"',
- \OCP\Util::ERROR
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Could not load storage.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
return null;
}
}
@@ -478,11 +478,10 @@ abstract class StoragesService {
// can happen either for invalid configs where the storage could not
// be instantiated or whenever $user vars where used, in which case
// the storage id could not be computed
- \OCP\Util::writeLog(
- 'files_external',
- 'Exception: "' . $e->getMessage() . '"',
- \OCP\Util::ERROR
- );
+ \OC::$server->getLogger()->logException($e, [
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'files_external',
+ ]);
}
}
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index 10876e16568..990571b778f 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -482,7 +482,7 @@ class ShareAPIController extends OCSController {
$code = $e->getCode() === 0 ? 403 : $e->getCode();
throw new OCSException($e->getHint(), $code);
} catch (\Exception $e) {
- throw new OCSForbiddenException($e->getMessage());
+ throw new OCSForbiddenException($e->getMessage(), $e);
}
$output = $this->formatShare($share);
@@ -749,7 +749,7 @@ class ShareAPIController extends OCSController {
try {
$expireDate = $this->parseDate($expireDate);
} catch (\Exception $e) {
- throw new OCSBadRequestException($e->getMessage());
+ throw new OCSBadRequestException($e->getMessage(), $e);
}
$share->setExpirationDate($expireDate);
}
@@ -780,7 +780,7 @@ class ShareAPIController extends OCSController {
try {
$expireDate = $this->parseDate($expireDate);
} catch (\Exception $e) {
- throw new OCSBadRequestException($e->getMessage());
+ throw new OCSBadRequestException($e->getMessage(), $e);
}
$share->setExpirationDate($expireDate);
}
@@ -809,7 +809,7 @@ class ShareAPIController extends OCSController {
try {
$share = $this->shareManager->updateShare($share);
} catch (\Exception $e) {
- throw new OCSBadRequestException($e->getMessage());
+ throw new OCSBadRequestException($e->getMessage(), $e);
}
return new DataResponse($this->formatShare($share));
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php
index 5eaf502f236..e6609034f91 100644
--- a/apps/files_trashbin/lib/Storage.php
+++ b/apps/files_trashbin/lib/Storage.php
@@ -130,8 +130,11 @@ class Storage extends Wrapper {
}
} catch (\Exception $e) {
// do nothing, in this case we just disable the trashbin and continue
- $logger = \OC::$server->getLogger();
- $logger->debug('Trashbin storage could not check if a file was moved out of a shared folder: ' . $e->getMessage());
+ \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,
+ 'app' => 'files_trashbin',
+ ]);
}
if($fileMovedOutOfSharedFolder) {
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index ffae68d5a95..9098797f1ac 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -197,7 +197,11 @@ class UsersController extends OCSController {
}
return new DataResponse();
} catch (\Exception $e) {
- $this->logger->error('Failed addUser attempt with exception: '.$e->getMessage(), ['app' => 'ocs_api']);
+ $this->logger->logException($e, [
+ 'message' => 'Failed addUser attempt with exception.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'ocs_api',
+ ]);
throw new OCSException('Bad request', 101);
}
}
@@ -826,7 +830,11 @@ class UsersController extends OCSController {
$emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false);
$this->newUserMailHelper->sendMail($targetUser, $emailTemplate);
} catch(\Exception $e) {
- $this->logger->error("Can't send new user mail to $email: " . $e->getMessage(), array('app' => 'settings'));
+ $this->logger->logException($e, [
+ 'message' => "Can't send new user mail to $email",
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'settings',
+ ]);
throw new OCSException('Sending email failed', 102);
}
diff --git a/apps/provisioning_api/tests/Controller/UsersControllerTest.php b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
index ef47583e9df..c2ad36c455c 100644
--- a/apps/provisioning_api/tests/Controller/UsersControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/UsersControllerTest.php
@@ -414,6 +414,7 @@ class UsersControllerTest extends TestCase {
* @expectedExceptionMessage Bad request
*/
public function testAddUserUnsuccessful() {
+ $exception = new Exception('User backend not found.');
$this->userManager
->expects($this->once())
->method('userExists')
@@ -423,11 +424,15 @@ class UsersControllerTest extends TestCase {
->expects($this->once())
->method('createUser')
->with('NewUser', 'PasswordOfTheNewUser')
- ->will($this->throwException(new Exception('User backend not found.')));
+ ->will($this->throwException($exception));
$this->logger
->expects($this->once())
- ->method('error')
- ->with('Failed addUser attempt with exception: User backend not found.', ['app' => 'ocs_api']);
+ ->method('logException')
+ ->with($exception, [
+ 'message' => 'Failed addUser attempt with exception.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'ocs_api',
+ ]);
$loggedInUser = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index f610a1a5fa9..287c6abff59 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -351,11 +351,19 @@ class ShareByMailProvider implements IShareProvider {
$share->getExpirationDate()
);
} catch (HintException $hintException) {
- $this->logger->error('Failed to send share by mail: ' . $hintException->getMessage());
+ $this->logger->logException($hintException, [
+ 'message' => 'Failed to send share by mail.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'sharebymail',
+ ]);
$this->removeShareFromTable($shareId);
throw $hintException;
} catch (\Exception $e) {
- $this->logger->error('Failed to send share by email: ' . $e->getMessage());
+ $this->logger->logException($e, [
+ 'message' => 'Failed to send share by mail.',
+ 'level' => \OCP\Util::ERROR,
+ 'app' => 'sharebymail',
+ ]);
$this->removeShareFromTable($shareId);
throw new HintException('Failed to send share by mail',
$this->l->t('Failed to send share by email'));
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index c93d2a77d80..8bde353a560 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -595,9 +595,11 @@ class User {
$avatar = $this->avatarManager->getAvatar($this->uid);
$avatar->set($this->image);
} catch (\Exception $e) {
- \OC::$server->getLogger()->notice(
- 'Could not set avatar for ' . $this->dn . ', because: ' . $e->getMessage(),
- ['app' => 'user_ldap']);
+ \OC::$server->getLogger()->logException($e, [
+ 'message' => 'Could not set avatar for ' . $this->dn,
+ 'level' => \OCP\Util::INFO,
+ 'app' => 'user_ldap',
+ ]);
}
}