summaryrefslogtreecommitdiff
path: root/public_html
diff options
context:
space:
mode:
authorThomas <tb@woodcrest.local>2013-11-01 11:55:31 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-11-01 12:46:07 (GMT)
commit0a8caed68666a824b5b8ccf2e1869d2dc53222d4 (patch)
tree7950ef667b0a77637b5ad3a71a10ecf27b30537e /public_html
parent7fd21807c61e345f67f798760fe02821d0db19db (diff)
downloadiRony-0a8caed68666a824b5b8ccf2e1869d2dc53222d4.tar.gz
Better logging facilities to enable per-user debug log (#2462)
Diffstat (limited to 'public_html')
-rw-r--r--public_html/index.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/public_html/index.php b/public_html/index.php
index a702fef..5d12f14 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -66,12 +66,31 @@ $required = array('libkolab', 'libcalendaring');
$rcube->plugins->init($rcube);
$rcube->plugins->load_plugins($plugins, $required);
+
// convenience function, you know it well :-)
function console()
{
global $rcube;
- if ($rcube->config->get('kolab_dav_console', false))
+
+ // write to global console log
+ if ($rcube->config->get('kolabdav_console', false)) {
call_user_func_array(array('rcube', 'console'), func_get_args());
+ }
+
+ // dump console data per user
+ if ($rcube->config->get('kolabdav_user_debug', false)) {
+ $uname = \Kolab\DAV\Auth\HTTPBasic::$current_user;
+ $log_dir = $rcube->config->get('log_dir', RCUBE_INSTALL_PATH . 'logs');
+
+ if ($uname && $log_dir && is_writable($log_dir . '/' . $uname)) {
+ $msg = array();
+ foreach (func_get_args() as $arg) {
+ $msg[] = !is_string($arg) ? var_export($arg, true) : $arg;
+ }
+
+ rcube::write_log($uname . '/console', join(";\n", $msg));
+ }
+ }
}
@@ -130,6 +149,11 @@ $server->setBaseUri($base_uri);
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($auth_backend, 'KolabDAV'));
$server->addPlugin(new \Sabre\DAVACL\Plugin());
+// enable logger
+if ($rcube->config->get('kolabdav_console') || $rcube->config->get('kolabdav_user_debug')) {
+ $server->addPlugin(new \Kolab\Utils\DAVLogger());
+}
+
if ($services['CALDAV']) {
$caldav_plugin = new \Kolab\CalDAV\Plugin();
$caldav_plugin->setIMipHandler(new \Kolab\CalDAV\IMip());
@@ -158,3 +182,5 @@ if (getenv('DAVBROWSER')) {
// finally, process the request
$server->exec();
+// trigger log
+$server->broadcastEvent('exit', array());