Skip to content
Snippets Groups Projects
Commit c4dee281 authored by Vincent Petry's avatar Vincent Petry
Browse files

Added $app parameter to logException

parent 42c58220
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ try {
OC::handleRequest();
} catch (Exception $ex) {
\OCP\Util::logException($ex);
\OCP\Util::logException('index', $ex);
//show the user a detailed error page
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
......
......@@ -82,19 +82,19 @@ class Util {
* if DEBUG mode is enabled
* @param Exception $ex exception to log
*/
public static function logException( \Exception $ex ) {
public static function logException( $app, \Exception $ex ) {
$message = $ex->getMessage();
if ($ex->getCode()) {
$message .= ' [' . $ex->getCode() . ']';
}
\OCP\Util::writeLog('index', 'Exception: ' . $message, \OCP\Util::FATAL);
\OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL);
if (defined('DEBUG') and DEBUG) {
// also log stack trace
$stack = explode('#', $ex->getTraceAsString());
// first element is empty
array_shift($stack);
foreach ($stack as $s) {
\OCP\Util::writeLog('index', 'Exception: ' . $s, \OCP\Util::FATAL);
\OCP\Util::writeLog($app, 'Exception: ' . $s, \OCP\Util::FATAL);
}
// include cause
......@@ -105,7 +105,7 @@ class Util {
if ($ex->getCode()) {
$message .= '[' . $ex->getCode() . '] ';
}
\OCP\Util::writeLog('index', 'Exception: ' . $message, \OCP\Util::FATAL);
\OCP\Util::writeLog($app, 'Exception: ' . $message, \OCP\Util::FATAL);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment