diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-01-23 12:11:53 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-01-27 11:40:17 +0100 |
commit | 11ef12a1060f3e34312ae40c690f95765d7c5f89 (patch) | |
tree | b270925af62a00bef1a5e77448db4fa0a42cf388 /lib/public | |
parent | 0daabe5b6a2f96e8b754c2414bb83d00277a307a (diff) | |
download | nextcloud-server-11ef12a1060f3e34312ae40c690f95765d7c5f89.tar.gz nextcloud-server-11ef12a1060f3e34312ae40c690f95765d7c5f89.zip |
Added exception logger plugin for sabre connector
Whenever an exception occurs in the sabre connector code or code called
by it, it will be logged.
This plugin approach is needed because Sabre already catches exceptions
to return them to the client in the XML response, so they don't appear
logged in the web server log.
This will make it much easier to debug syncing issues.
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/util.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/public/util.php b/lib/public/util.php index 8e85f9afc3f..e893a76d811 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -88,14 +88,18 @@ class Util { * @param Exception $ex exception to log */ public static function logException( $app, \Exception $ex ) { - $message = $ex->getMessage(); + $class = get_class($ex); + if ($class !== 'Exception') { + $message = $class . ': '; + } + $message .= $ex->getMessage(); if ($ex->getCode()) { $message .= ' [' . $ex->getCode() . ']'; } \OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL); if (defined('DEBUG') and DEBUG) { // also log stack trace - $stack = explode('#', $ex->getTraceAsString()); + $stack = explode("\n", $ex->getTraceAsString()); // first element is empty array_shift($stack); foreach ($stack as $s) { |