Allow for configuring a separate log file specifically for activesync requests
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 6 Apr 2010 00:43:40 +0000 (20:43 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 6 Apr 2010 00:44:38 +0000 (20:44 -0400)
horde/config/conf.xml
horde/rpc.php

index 09d3445..1438aeb 100644 (file)
       <configstring name="directory" desc="Directory to hold state files (this
       directory should be writeable by the webserver):">/tmp</configstring>
      </configsection>
+     <configheader>Logging</configheader>
+     <configsection name="logging">
+      <configswitch name="type" desc="For debugging, it may be useful to send
+      activesync-related log messages to a seperate log. If you want to do this,
+      set this to Custom and enter the path to the log file to use.">
+        <case name="horde" desc="Horde" />
+        <case name="custom" desc="Custom">
+         <configstring name="path" desc="Path to logfile" />
+        </case>
+      </configswitch>
+     </configsection>
      <configsection name="securitypolicies">
      <configheader>Security Policies</configheader>
       <configswitch name="provisioning" quote="false" desc="How should device
index 15cea1f..54dcde4 100644 (file)
@@ -30,8 +30,11 @@ Horde_Registry::appInit('horde', array('authentication' => 'none', 'nocompress'
 $request = new Horde_Controller_Request_Http();
 
 /* TODO: This is for debugging, replace with logger from injector before merge */
-//$params['logger'] = new Horde_Log_Logger(new Horde_Log_Handler_Stream(fopen('/tmp/activesync.txt', 'a')));
-$params['logger'] = $GLOBALS['injector']->getInstance('Horde_Log_Logger');
+if ($conf['activesync']['logging']['type'] == 'custom') {
+    $params['logger'] = new Horde_Log_Logger(new Horde_Log_Handler_Stream(fopen($conf['activesync']['logging']['path'], 'a')));
+} else {
+    $params['logger'] = $GLOBALS['injector']->getInstance('Horde_Log_Logger');
+}
 
 /* Look at the Content-type of the request, if it is available, to try
  * and determine what kind of request this is. */