/**
  * Initialize this AgaviLoggingManager.
  *
  * @param      AgaviContext An AgaviContext instance.
  * @param      array        An array of initialization parameters.
  *
  * @throws     <b>AgaviInitializationException</b> If an error occurs while
  *                                                 initializing this instance.
  *
  * @author     David Zülke <*****@*****.**>
  * @author     Sean Kerr <*****@*****.**>
  * @since      0.9.0
  */
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     $this->context = $context;
     if (isset($parameters['default_message_class'])) {
         $this->defaultMessageClass = $parameters['default_message_class'];
     }
     // load logging configuration
     require AgaviConfigCache::checkConfig(AgaviConfig::get('core.config_dir') . '/logging.xml', $context->getName());
 }
 /**
  * Initialize this Filter Chain.
  *
  * @param      AgaviResponse the Response instance for this Chain.
  * @param      array An array of initialization parameters.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      0.11.0
  */
 public function initialize(AgaviContext $context, array $parameters = array())
 {
     $this->context = $context;
     $this->filterLogKey = $context->getName();
 }
 /**
  * Pretty-print this exception using a template.
  *
  * @param      Exception     The original exception.
  * @param      AgaviContext  The context instance.
  * @param      AgaviResponse The response instance.
  *
  * @author     David Zülke <*****@*****.**>
  * @since      1.0.0
  */
 public static function render(Exception $e, AgaviContext $context = null, AgaviExecutionContainer $container = null)
 {
     // exit code is 70, EX_SOFTWARE, according to /usr/include/sysexits.h: http://cvs.opensolaris.org/source/xref/on/usr/src/head/sysexits.h
     // nice touch: an exception template can change this value :)
     $exitCode = 70;
     $exceptions = array();
     if (version_compare(PHP_VERSION, '5.3', 'ge')) {
         // reverse order of exceptions
         $ce = $e;
         while ($ce) {
             array_unshift($exceptions, $ce);
             $ce = $ce->getPrevious();
         }
     } else {
         $exceptions[] = $e;
     }
     if ($container !== null && $container->getOutputType() !== null && $container->getOutputType()->getExceptionTemplate() !== null) {
         // an exception template was defined for the container's output type
         include $container->getOutputType()->getExceptionTemplate();
         exit($exitCode);
     }
     if ($context !== null && $context->getController() !== null) {
         try {
             // check if an exception template was defined for the default output type
             if ($context->getController()->getOutputType()->getExceptionTemplate() !== null) {
                 include $context->getController()->getOutputType()->getExceptionTemplate();
                 exit($exitCode);
             }
         } catch (Exception $e2) {
             unset($e2);
         }
     }
     if ($context !== null && AgaviConfig::get('exception.templates.' . $context->getName()) !== null) {
         // a template was set for this context
         include AgaviConfig::get('exception.templates.' . $context->getName());
         exit($exitCode);
     }
     // include default exception template
     include AgaviConfig::get('exception.default_template');
     // bail out
     exit($exitCode);
 }