0009788: Possibility to save queries into syslog
authorFlávio Gomes da Silva Lisboa <flavio.lisboa@serpro.gov.br>
Fri, 21 Mar 2014 15:20:24 +0000 (16:20 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 21 Mar 2014 15:39:51 +0000 (16:39 +0100)
- This change allows storing of queries into syslog

https://forge.tine20.org/mantisbt/view.php?id=9788

Change-Id: Ic6b8ab1c380750546565e7c50bede7f9740837fc
Reviewed-on: https://gerrit.tine20.org/tine20/2815
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: jenkins user
tine20/Tinebase/Core.php

index bae7431..a2cb56b 100644 (file)
@@ -585,6 +585,17 @@ class Tinebase_Core
                 $writer = ($_defaultWriter === NULL) ? new Zend_Log_Writer_Null() : $_defaultWriter;
                 $logger->addWriter($writer);
             }
+
+            // For saving log into syslog too, create a key syslog into logger (value does not matter)
+            if ((bool) $config->logger->syslog){
+                $writer = new Zend_Log_Writer_Syslog(array(
+                        'application'   => 'Tine 2.0'
+                ));
+                $prio = ($config->logger->priority) ? (int) $config->logger->priority : 3;
+                $filter = new Zend_Log_Filter_Priority($prio);
+                $writer->addFilter($filter);
+                $logger->addWriter($writer);
+            }
         } else {
             $writer = new Zend_Log_Writer_Syslog(array(
                 'application'   => 'Tine 2.0'