[development] New Drupal Logging to text file Module

Khalid Baheyeldin kb at 2bits.com
Mon Feb 11 14:58:25 UTC 2008


The correct way to do this is to use the new watchdog hook that made it
to Drupal 6.

Here is the API call

There are already standards in place for alert levels that the above hook
and modules that call it can use.

There is a backport of that to Drupal 5.x here

The syslog module in the above patch, and in D6 can already log to
a flat file, and the output is themable so you can format it however
you like.

Here is an example module that does logging to email per severity level.

On Feb 11, 2008 8:03 AM, Ian Bezanson <irb at ianbezanson.ca> wrote:

> And again...
> The company I work for bases all of our projects on the Drupal
> infratructure.  The watchdog application simply doesn't work for us, so
> I'd created a module to log messages to file in the format:
> 00:00:58 [module::function_name][LOG_LEVEL]: Checking to see if user
> 0c2f977cc24e4e41d8cd6d9a4099ab0b is anonymous.
> We've decided that this is likely a worthwhile project to release to the
> community, so I am currently working on a release.  Right now, I have a
> group of Log Levels (FATAL, ERROR, WARN, INFO, DEBUG, TRACE), one log
> type (DRUPAL_BASE) and the ability to add/configure more.
> The site admin can configure whether or not to turn on logging, a
> minimum log level to write out, where the log files should live, etc.
> I will send another message once the initial release is made, but wanted
> to gauge what people thought about this module.  It's more of a
> developer's module, as it requires developers to add a hook, such as:
>  drupal_log_to_file("MODULE_NAME::FUNCTION_NAME", "LOG_TYPE",
> into their code, in order for the system to log anything.
> Let me know anyone's thoughts :)
> --
> Ian Bezanson
> irb at ianbezanson.ca

Khalid M. Baheyeldin
2bits.com, Inc.
Drupal optimization, development, customization and consulting.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080211/68b5dc52/attachment.htm 

More information about the development mailing list