Fresh Blurbs

Basic PHP Logging

One of the most powerful ways to debug a web application is using logging; especially for a highly complex system like Drupal. PHP comes with a built-in logging function: error_log();. The exact behavior of this function depends on several configuration parameters.

We suggest that you log into standard Apache error log and create one log per virtual host. To achieve this, make sure that in php.ini you have "error_log = " directive commented-out, so that PHP does not log either in one specific file or syslog, and also make sure you have "log_errors = On". In addition, in httpd.conf (or wherever you have virtual hosts configured in Apache) for the virtual host configurations, make sure you have separate log files per a Virtual Host with a directive like: ErrorLog logs/buzzmonitor.log

The basic logger is not as powerful as the PEAR logger, but is much safer. If you use PEAR logger, you must be sure that anywhere your code will be installed, PEAR Log module will be installed, too. That is not a safe assumption, especially for Drupal developers that publish their code in open-source.

comments powered by Disqus