From 90bd0a1ab4169c86ef1f16501e7b22e96b068b84 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Tue, 16 Jun 2015 14:35:29 -0400 Subject: [PATCH] Attempt at fixing Sentry error logging --- airtime_mvc/application/airtime-boot.php | 6 +++--- airtime_mvc/application/controllers/plugins/Acl_plugin.php | 2 +- airtime_mvc/application/logging/Logging.php | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/airtime-boot.php b/airtime_mvc/application/airtime-boot.php index 0fb1212dd..08a5b9869 100644 --- a/airtime_mvc/application/airtime-boot.php +++ b/airtime_mvc/application/airtime-boot.php @@ -100,10 +100,10 @@ try { echo "
";
         echo $e->getTraceAsString();
         echo "
"; - Logging::info($e->getMessage()); - Logging::info($e->getTraceAsString()); + Logging::error($e->getMessage()); + Logging::error($e->getTraceAsString()); } else { - Logging::info($e->getTrace()); + Logging::error($e->getTrace()); } throw $e; } diff --git a/airtime_mvc/application/controllers/plugins/Acl_plugin.php b/airtime_mvc/application/controllers/plugins/Acl_plugin.php index 3249bd4a2..c08533ab9 100644 --- a/airtime_mvc/application/controllers/plugins/Acl_plugin.php +++ b/airtime_mvc/application/controllers/plugins/Acl_plugin.php @@ -134,7 +134,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract //$r->gotoSimpleAndExit('index', 'login', $request->getModuleName()); //die(); - throw new Zend_Controller_Exception("hi", 401); + throw new Zend_Controller_Exception("Incorrect API key", 401); } } else //Non-REST, regular Airtime web app requests diff --git a/airtime_mvc/application/logging/Logging.php b/airtime_mvc/application/logging/Logging.php index d6d30e932..23b377686 100644 --- a/airtime_mvc/application/logging/Logging.php +++ b/airtime_mvc/application/logging/Logging.php @@ -83,7 +83,11 @@ class Logging { { $logger = self::getLogger(); $logger->err(self::getLinePrefix(true) . self::toString($p_msg)); - SentryLogger::getInstance()->captureError(self::toString($p_msg)); + + //Escape the % symbols in any of our errors because Sentry chokes (vsprint formatting error). + $msg = self::toString($p_msg); + $msg = str_replace("%", "%%", $msg); + SentryLogger::getInstance()->captureError($msg); } public static function debug($p_msg)