diff --git a/core/Log/Handler/StdErrHandler.php b/core/Log/Handler/StdErrHandler.php
index 77c2f78cde2ada082285defec55fbaefd88ba3d4..6ab856b66ff42b75bea4a41b548a7b4e7aaefa8d 100644
--- a/core/Log/Handler/StdErrHandler.php
+++ b/core/Log/Handler/StdErrHandler.php
@@ -36,7 +36,10 @@ class StdErrHandler extends AbstractProcessingHandler
 
     protected function write(array $record)
     {
-        $this->writeToStdErr($record['formatted']);
+        // Do not log on stderr during tests (prevent display of errors in CI output)
+        if (! defined('PIWIK_TEST_MODE')) {
+            $this->writeToStdErr($record['formatted']);
+        }
 
         // This is the result of an old hack, I guess to force the error message to be displayed in case of errors
         // TODO we should get rid of it somehow