How to call watchdog() outside Drupal I'm getting used to use the Drupal watchdog() function. It provides me a very simple and accessible way to log events in my code.

However, I would like to use the same (or very similar) function in some other PHP projects outside Drupal. Accessing the results via the Drupal reports interface would be nice.

Does anyone know any proper way to include the relevant files of a Drupal instance to provide this functionality in custom PHP code? I know that there are already other PHP logging solutions which may be better, but I'm looking for something similar to watchdog().
Requiring the existence of a Drupal installation for all of your other non-Drupal PHP projects isn't something I've come across before...but you can bootstrap Drupal to make the watchdog() function available like so:

define('DRUPAL_ROOT', '/path/to/drupal/installation');
include_once(DRUPAL_ROOT . '/includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

watchdog('my_module', 'A message');