The Drupal Log To File is built as an alternative to the watchdog interface, aimed at alleviating database load when logging events/actions of the system. With this module, the developer can send logs directly to a flat file in the format:


and can be called from your code-base like:


The module has six built-in log levels (FATAL, ERROR, WARN, INFO, DEBUG, TRACE) and one default log type (DRUPAL_BASE), but is configurable through an administrative page to add as many types as the developer/user wishes. There is also a built in function, log_to_file_arrject() which allows you to input arrays and/or objects, which will be dumped to the log file in human-readable format, similar to:

global $user;
drupal_log_to_file("My Module::my_module_main", "DRUPAL_BASE", "LOG_LEVEL_TRACE", "New user logged into my_module_main:\n" . log_to_file_arrject($user));

This project is sponsored by: Barscope Interactive Data Systems

Project Information