Debugging: Difference between revisions

From Davical
Jump to navigationJump to search
 
(source is on gitlab now)
 
Line 78: Line 78:
  $c->override_allowed_methods = "PROPPATCH, OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MKCALENDAR, LOCK, UNLOCK, REPORT"
  $c->override_allowed_methods = "PROPPATCH, OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MKCALENDAR, LOCK, UNLOCK, REPORT"


Source: [http://repo.or.cz/w/davical.git/blob/HEAD:/config/debug-config.php debug-config.php]
Source: [https://gitlab.com/davical-project/davical/blob/master/config/debug-config.php debug-config.php]

Latest revision as of 23:27, 22 November 2018

Debugging Installation Problems

First, make sure your problem is not described in the FAQ!

Second, if you have a particular error message, try typing it into Google, or into the search box on this wiki.

Third, ask on IRC or on the Mailing List

Debug Logging

DAViCal supports extensive debug logging, including many flags which are generally not useful for debugging actual live issues. In particular do NOT use the 'all' debug setting unless a developer recommends it as this level of debugging is so verbose as to be useless (megabytes / minute on even a lightly loaded server) and can cause further errors unrelated to the problem you are attempting to solve.

The most useful debugging level for resolving CalDAV problems is:

$c->dbg = array( 'statistics' => 1, 'request' => 1, 'response' => 1 );

This will cause the following to be written into the PHP error log (which by default will be the Apache error log):

  • Complete request headers & body.
  • Complete response headers & body.
  • A line of statistics after each response has been sent.

Restricting Logging to a Single Client

It may be that you want the logging to be restricted to only a single client that is experiencing the problem, or just to limit the amount of logged data to understand the problem without all of the interspersed logging for unrelated clients. DAViCal's config file is PHP code, so this can be done relatively easily by something like the following:

$c->dbg = array();  // default debug logging to off
if ( isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] == '172.18.219.2' )
  $c->dbg = array( 'statistics' => 1, 'request' => 1, 'response' => 1 );

If you know that the problem applies for a particular user, and is only related to what happens to authenticated requests, you could use a different variable for the user, as follows:

$c->dbg = array();  // default debug logging to off
if ( (isset($_SERVER['REMOTE_USER']) && $_SERVER['REMOTE_USER'] == 'andrew')
      || (isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER'] == 'andrew') )
  $c->dbg = array( 'statistics' => 1, 'request' => 1, 'response' => 1 );

Debug Config Options

If you want to debug you have to set to 1 one of this variable and then you can look at the error log of PHP for example :

$c->dbg["ALL"] = 1;

and then:

tail -f /var/log/apache2/error_log

(or wherever PHP errors are logged).

List of Config Options

$c->dbg["ALL"] = 1;
$c->dbg["request"] = 1;   // The request headers & content
$c->dbg['response'] = 1;  // The response headers & content
$c->dbg["component"] = 1;
$c->dbg['caldav'] = 1;
$c->dbg['querystring'] = 1;
$c->dbg['icalendar'] = 1;
$c->dbg['ics'] = 1;
$c->dbg['login'] = 1;
$c->dbg['options'] = 1;
$c->dbg['get'] = 1;
$c->dbg['put'] = 1;
$c->dbg['propfind'] = 1;
$c->dbg['proppatch'] = 1;
$c->dbg['report'] = 1;
$c->dbg['principal'] = 1;
$c->dbg['user'] = 1;
$c->dbg['vevent'] = 1;
$c->dbg['rrule'] = 1;

By default 'davical' used to prefix debugging messages but will only need to change if you are running multiple DAViCal servers logging into the same place.

$c->sysabbr = 'davical';

As yet we only support quite a limited range of options. When we see clients looking for more than this we will work to support them further. So we can see clients trying to use such methods there is a configuration option to override and allow lying about what is available.

Example:

$c->override_allowed_methods = "PROPPATCH,OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MKCALENDAR, LOCK, UNLOCK, REPORT"

Don't muck with this unless you are trying to write code to support a new option!

$c->override_allowed_methods = "PROPPATCH, OPTIONS, GET, HEAD, PUT, DELETE, PROPFIND, MKCOL, MKCALENDAR, LOCK, UNLOCK, REPORT"

Source: debug-config.php