diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index c5633e369..31728a3c0 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -300,6 +300,14 @@ class ShowbuilderController extends Zend_Controller_Action $log_vars["params"]["scheduled_items"] = $scheduledItems; Logging::info($log_vars); + $log_vars = array(); + $log_vars["url"] = $_SERVER['HTTP_HOST']; + $log_vars["action"] = "showbuilder/schedule-add"; + $log_vars["params"] = array(); + $log_vars["params"]["media_items"] = $mediaItems; + $log_vars["params"]["scheduled_items"] = $scheduledItems; + Logging::info($log_vars); + try { $scheduler = new Application_Model_Scheduler(); $scheduler->scheduleAfter($scheduledItems, $mediaItems); diff --git a/airtime_mvc/application/logging/Logging.php b/airtime_mvc/application/logging/Logging.php index 06a30398f..5aef4baba 100644 --- a/airtime_mvc/application/logging/Logging.php +++ b/airtime_mvc/application/logging/Logging.php @@ -125,4 +125,49 @@ class Logging { Propel::setLogger(null); } + public static function loggingShutdownCallback() + { + //Catch the types of errors that PHP doesn't normally let us catch and + //would otherwise log to the apache log. We route these to our Airtime log to improve the modularity + //and reliability of our error logging. (All errors are in one spot!) + $err = error_get_last(); + if (!is_array($err) || !array_key_exists('type', $err)) { + return; + } + + switch($err['type']) + { + case E_ERROR: + case E_PARSE: + case E_CORE_ERROR: + case E_CORE_WARNING: + case E_COMPILE_ERROR: + case E_COMPILE_WARNING: + //error_log("Oh noes, a fatal: " . var_export($err, true), 1, 'fatals@example.com'); + $errorStr = ''; + if (array_key_exists('message', $err)) { + $errorStr .= $err['message']; + } + if (array_key_exists('file', $err)) + { + $errorStr .= ' at ' .$err['file']; + } + if (array_key_exists('line', $err)) + { + $errorStr .= ':' . $err['line']; + } + + $errorStr .= "\n" . var_export($err, true); + Logging::error($errorStr); + break; + } + } + + public static function setupParseErrorLogging() + { + //Static callback: + register_shutdown_function('Logging::loggingShutdownCallback'); + } + } + diff --git a/airtime_mvc/public/index.php b/airtime_mvc/public/index.php index 6c435b336..7a99db0b3 100644 --- a/airtime_mvc/public/index.php +++ b/airtime_mvc/public/index.php @@ -79,6 +79,7 @@ $application = new Zend_Application( require_once (APPLICATION_PATH."/logging/Logging.php"); Logging::setLogPath('/var/log/airtime/zendphp.log'); +Logging::setupParseErrorLogging(); // Create application, bootstrap, and run try {