diff options
author | CiaranG <ciaran@ciarang.com> | 2009-03-04 00:23:34 +0000 |
---|---|---|
committer | CiaranG <ciaran@ciarang.com> | 2009-03-04 00:23:34 +0000 |
commit | 7279554681da728deb74a87230de3a1021182f71 (patch) | |
tree | 99b7c355c7add14f7f68624d764d016cfa18e959 | |
parent | 35677336de4c01c4f6b02840222075c6ac963988 (diff) |
Additional (optional, defaults to off) logging of PEAR error details, which allows database issues to be more easily diagnosed.
-rw-r--r-- | config.php.sample | 3 | ||||
-rw-r--r-- | index.php | 6 | ||||
-rw-r--r-- | lib/common.php | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/config.php.sample b/config.php.sample index 6e55eaffc..a6cada77a 100644 --- a/config.php.sample +++ b/config.php.sample @@ -34,6 +34,9 @@ $config['site']['path'] = 'laconica'; # If you want logging sent to a file instead of syslog #$config['site']['logfile'] = '/tmp/laconica.log'; +# Enables extra log information, for example full details of PEAR DB errors +#$config['site']['logdebug'] = true; + # This is a PEAR DB DSN, see http://pear.php.net/manual/en/package.database.db.intro-dsn.php # Set it to match your actual database @@ -43,7 +43,11 @@ function handleError($error) return; } - common_log(LOG_ERR, "PEAR error: " . $error->getMessage()); + $logmsg = "PEAR error: " . $error->getMessage(); + if(common_config('site', 'logdebug')) { + $logmsg .= " : ". $error->getDebugInfo(); + } + common_log(LOG_ERR, $logmsg); $msg = sprintf(_('The database for %s isn\'t responding correctly, '. 'so the site won\'t work properly. '. 'The site admins probably know about the problem, '. diff --git a/lib/common.php b/lib/common.php index 0fff3af2e..3df68d98a 100644 --- a/lib/common.php +++ b/lib/common.php @@ -73,6 +73,7 @@ $config = 'theme' => 'default', 'path' => $_path, 'logfile' => null, + 'logdebug' => false, 'fancy' => false, 'locale_path' => INSTALLDIR.'/locale', 'language' => 'en_US', |