예제 #1
0
 /**
  * The default error handler action
  */
 public function errorAction()
 {
     $this->getLogger()->debug("\n");
     $this->getLogger()->debug('ErrorController::errorAction()');
     $log = "\n\n************************************************************************\n" . "****************************** EXCEPTIONS *******************************\n" . "************************************************************************\n\n";
     $exceptions = $this->getResponse()->getException();
     if (is_array($exceptions)) {
         foreach ($exceptions as $e) {
             $log .= "--------------------------- EXCEPTION --------------------------\n\n" . "Message: " . $e->getMessage() . "\nLine: " . $e->getLine() . "\nFile: " . $e->getFile();
             $log .= "\n\nTrace:\n\n" . $e->getTraceAsString() . "\n\n" . print_r(OSS_Debug::compact_debug_backtrace(), true) . "\n\n";
         }
     }
     $log .= "------------------------\n\n" . "HTTP_HOST : {$_SERVER['HTTP_HOST']}\n" . "HTTP_USER_AGENT: {$_SERVER['HTTP_USER_AGENT']}\n" . (isset($_SERVER['HTTP_COOKIE']) ? "HTTP_COOKIE: {$_SERVER['HTTP_COOKIE']}\n" : "") . "REMOTE_PORT: {$_SERVER['REMOTE_PORT']}\n" . "REQUEST_METHOD: {$_SERVER['REQUEST_METHOD']}\n" . "REQUEST_URI: {$_SERVER['REQUEST_URI']}\n\n";
     $this->getResponse()->setBody('OK: 0');
     if (isset($this->view)) {
         if ($errors = $this->_getParam('error_handler', false)) {
             $this->getResponse()->clearBody();
             switch ($errors->type) {
                 case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
                 case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                     // 404 error -- controller or action not found
                     $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
                     Zend_Controller_Action_HelperBroker::removeHelper('viewRenderer');
                     $this->view->display('error/error-404.phtml');
                     $this->getLogger()->debug($log);
                     break;
                 default:
                     $this->getLogger()->err($log);
                     $this->view->exceptions = $exceptions;
                     break;
             }
         }
     }
     return true;
 }
예제 #2
0
 private function log()
 {
     $this->getLogger()->debug("\n");
     $this->getLogger()->debug('ErrorController::errorAction()');
     $log = "\n\n************************************************************************\n" . "****************************** EXCEPTIONS *******************************\n" . "************************************************************************\n\n";
     $exceptions = $this->getResponse()->getException();
     if (is_array($exceptions)) {
         foreach ($exceptions as $e) {
             $log .= "--------------------------- EXCEPTION --------------------------\n\n" . "Message: " . $e->getMessage() . "\nLine: " . $e->getLine() . "\nFile: " . $e->getFile();
             $log .= "\n\nTrace:\n\n" . $e->getTraceAsString() . "\n\n" . print_r(OSS_Debug::compact_debug_backtrace(), true) . "\n\n";
         }
     }
     $log .= "------------------------\n\n" . "HTTP_HOST : {$_SERVER['HTTP_HOST']}\n" . (isset($_SERVER['HTTP_USER_AGENT']) ? "HTTP_USER_AGENT: {$_SERVER['HTTP_USER_AGENT']}\n" : "") . (isset($_SERVER['HTTP_COOKIE']) ? "HTTP_COOKIE: {$_SERVER['HTTP_COOKIE']}\n" : "") . "REMOTE_PORT: {$_SERVER['REMOTE_PORT']}\n" . "REQUEST_METHOD: {$_SERVER['REQUEST_METHOD']}\n" . "REQUEST_URI: {$_SERVER['REQUEST_URI']}\n\n";
     $this->getLogger()->err($log);
 }
예제 #3
0
 public function cliPortRolesDeltaAction()
 {
     $devices = [];
     OSS_Debug::dd($devices);
     foreach ($this->_devices as $d) {
         $devices[$d] = [];
         try {
             $device = new \OSS_SNMP\SNMP($d, $this->_options['community']);
             $devices[$d]['instances'] = $device->useCisco_SMST()->instances();
             foreach ($devices[$d]['instances'] as $iid => $iname) {
                 $devices[$d]['instance_roles'][$iid] = $device->useCisco_MST()->portRoles($iid, true);
             }
             print_r($devices[$d]);
         } catch (\OSS_SNMP\Exception $e) {
             continue;
             return;
         }
     }
 }