From 9b63b4c318a951c8f8afc99944f97077924c7499 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 26 Sep 2012 11:26:30 -0400
Subject: [PATCH] Fixed console error logging.

---
 module/VuFind/src/VuFind/Bootstrap.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/module/VuFind/src/VuFind/Bootstrap.php b/module/VuFind/src/VuFind/Bootstrap.php
index 078c38f8a6e..981789e33fb 100644
--- a/module/VuFind/src/VuFind/Bootstrap.php
+++ b/module/VuFind/src/VuFind/Bootstrap.php
@@ -347,7 +347,11 @@ class Bootstrap
                 $log = $sm->get('Logger');
                 if (is_callable(array($log, 'logException'))) {
                     $exception = $event->getParam('exception');
-                    $server = $event->getRequest()->getServer();
+                    // Console request does not include server,
+                    // so use a dummy in that case.
+                    $server = Console::isConsole()
+                        ? new \Zend\Stdlib\Parameters(array('env' => 'console'))
+                        : $event->getRequest()->getServer();
                     if (!empty($exception)) {
                         $log->logException($exception, $server);
                     }
-- 
GitLab