Development

Changeset 6518

You must first sign up to be able to contribute.

Changeset 6518

Show
Ignore:
Timestamp:
12/16/07 08:26:27 (2 years ago)
Author:
fabien
Message:

added a log of all exception in the PHP log

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/exception/sfException.class.php

    r6514 r6518  
    6161    try 
    6262    { 
    63       $this->outputStackTrace(); 
     63      $exception = is_null($this->wrappedException) ? $this : $this->wrappedException; 
     64      $this->outputStackTrace($exception); 
    6465    } 
    6566    catch (Exception $e) 
     
    7677   * Gets the stack trace for this exception. 
    7778   */ 
    78   protected function outputStackTrace() 
    79   { 
    80     $exception = is_null($this->wrappedException) ? $this : $this->wrappedException; 
     79  static protected function outputStackTrace($exception) 
     80  { 
     81    // log all exceptions in php log 
     82    error_log($exception->getMessage()); 
    8183 
    8284    if (class_exists('sfContext', false) && sfContext::hasInstance()) 
     
    8688      if (sfConfig::get('sf_logging_enabled')) 
    8789      { 
    88         $dispatcher->notify(new sfEvent($this, 'application.log', array($this->getMessage(), 'priority' => sfLogger::ERR))); 
    89       } 
    90  
    91       $event = $dispatcher->notifyUntil(new sfEvent($this, 'application.throw_exception', array('exception' => $exception))); 
     90        $dispatcher->notify(new sfEvent($exception, 'application.log', array($exception->getMessage(), 'priority' => sfLogger::ERR))); 
     91      } 
     92 
     93      $event = $dispatcher->notifyUntil(new sfEvent($exception, 'application.throw_exception')); 
    9294      if ($event->isProcessed()) 
    9395      { 
     
    106108    } 
    107109 
    108     $message = null !== $this->getMessage() ? $this->getMessage() : 'n/a'; 
    109     $name    = get_class($this); 
     110    $message = null !== $exception->getMessage() ? $exception->getMessage() : 'n/a'; 
     111    $name    = get_class($exception); 
    110112    $format  = 0 == strncasecmp(PHP_SAPI, 'cli', 3) ? 'plain' : 'html'; 
    111113    $traces  = self::getTraces($exception, $format); 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.