diff --git a/config/vufind/config.ini b/config/vufind/config.ini
index 9a28d271c49150c4b991b233167dd71eea1d9131..d2472498d45e021eb7c2776171bf5c00cd23c06a 100644
--- a/config/vufind/config.ini
+++ b/config/vufind/config.ini
@@ -9,7 +9,8 @@
 ; up during ILS maintenance.
 available       = true
 ; Change to true to see messages about the behavior of the system as part of the
-; output -- only for use when troubleshooting problems:
+; output -- only for use when troubleshooting problems. See also the access.DebugMode
+; setting in permissions.ini to turn on debug using a GET parameter in the request.
 debug           = false
 ; This setting should be set to false after auto-configuration is complete
 autoConfigure = true
diff --git a/config/vufind/permissions.ini b/config/vufind/permissions.ini
index 1cf354c1aa212e43957823da769007c13131bf22..d0950159d3e84c21fcf5186eac9bfc7a4f2cfa86 100644
--- a/config/vufind/permissions.ini
+++ b/config/vufind/permissions.ini
@@ -61,6 +61,7 @@
 ; List of permissions that you may wish to configure:
 ;
 ; access.AdminModule - Controls access to the admin panel (if enabled in config.ini)
+; access.DebugMode - Allows ?debug=true GET parameter to turn on debug mode
 ; access.EITModule - Controls access to the EBSCO EIT module (if active)
 ; access.StaffViewTab - Controls access to the staff view tab in record mode
 ; access.SummonExtendedResults - Controls visibility of protected Summon results
@@ -76,6 +77,11 @@ role[] = guest
 role[] = loggedin
 permission = access.StaffViewTab
 
+; Example for dynamic debug mode
+;[default.DebugMode]
+;username[] = admin
+;permission = access.DebugMode
+
 ; Examples for Shibboleth
 ;
 ; Only users that have either common-lib-terms and entityid from idp1 or 
diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php
index 261c1ef3596e0ac17455fbb9e9d74fc283a7158a..f8722c436f13ff5a8d2d77c4da29b1b67974ef4a 100644
--- a/module/VuFind/src/VuFind/Bootstrapper.php
+++ b/module/VuFind/src/VuFind/Bootstrapper.php
@@ -146,6 +146,25 @@ class Bootstrapper
         $serviceManager->get('VuFind\AuthManager')->checkForExpiredCredentials();
     }
 
+    /**
+     * Initialize dynamic debug mode.
+     *
+     * @return void
+     */
+    protected function initDynamicDebug()
+    {
+        $app = $this->event->getApplication();
+        $sm = $app->getServiceManager();
+        $debugOverride = $sm->get('Request')->getQuery()->get('debug');
+        if ($debugOverride) {
+            $auth = $sm->get('ZfcRbac\Service\AuthorizationService');
+            if ($auth->isGranted('access.DebugMode')) {
+                $logger = $sm->get('VuFind\Logger');
+                $logger->addDebugWriter($debugOverride);
+            }
+        }
+    }
+
     /**
      * If the system is offline, set up a handler to override the routing output.
      *
diff --git a/module/VuFind/src/VuFind/Log/Logger.php b/module/VuFind/src/VuFind/Log/Logger.php
index e4fad47c0b812d4b8a5027a7e6f7f2d54090feb5..a225463a8b8be0df5cee4b8c7945f337b3425a17 100644
--- a/module/VuFind/src/VuFind/Log/Logger.php
+++ b/module/VuFind/src/VuFind/Log/Logger.php
@@ -61,18 +61,9 @@ class Logger extends BaseLogger implements ServiceLocatorAwareInterface
     {
         // DEBUGGER
         if (!$config->System->debug == false) {
-            $writer = new Writer\Stream('php://output');
-            $formatter = new \Zend\Log\Formatter\Simple(
-                '<pre>%timestamp% %priorityName%: %message%</pre>' . PHP_EOL
-            );
-            $writer->setFormatter($formatter);
-            $this->addWriters(
-                $writer,
-                'debug-'
-                . (is_int($config->System->debug) ? $config->System->debug : '5')
-            );
+            $this->addDebugWriter($config->System->debug);
         }
-        
+
         // Activate database logging, if applicable:
         if (isset($config->Logging->database)) {
             $parts = explode(':', $config->Logging->database);
@@ -135,6 +126,30 @@ class Logger extends BaseLogger implements ServiceLocatorAwareInterface
         }
     }
 
+    /**
+     * Add the standard debug stream writer.
+     *
+     * @param bool|int $debug Debug mode/level
+     *
+     * @return void
+     */
+    public function addDebugWriter($debug)
+    {
+        // Only add debug writer ONCE!
+        static $hasDebugWriter = false;
+        if ($hasDebugWriter) {
+            return;
+        }
+
+        $hasDebugWriter = true;
+        $writer = new Writer\Stream('php://output');
+        $formatter = new \Zend\Log\Formatter\Simple(
+            '<pre>%timestamp% %priorityName%: %message%</pre>' . PHP_EOL
+        );
+        $writer->setFormatter($formatter);
+        $this->addWriters($writer, 'debug-' . (is_int($debug) ? $debug : '5'));
+    }
+
     /**
      * Applies an array of filters to a writer
      *