[development] watchdog() does not always work - or am I missing something?

David Cohen drupal at dave-cohen.com
Wed Apr 22 03:58:38 UTC 2009

I'm debugging a situation where one of my drupal menu items is being
called via javascript, AJAX style.  To debug a problem, I've added
watchdog() calls to the callback - as a sanity check that the callback
is being reached, and so I can inspect some values.

The problem is that the log entries never show the messages I'm trying
to write.  Its as if the menu callback is never called.  However the
apache log shows that the path is being requested.  Let's say the path
is /drupal/my/callback.

Now, when I explicitly point a browser to the URL, lets say
http://example.com/drupal/my/callback, then the watchdog messages are
written to the log!  It's as if watchdog only succeeds when the browser
explicitly makes the request.

I've tried disabling drupal's cache.  I've tried refreshing the cache. 
No matter what I do, either my callback is not being called (despite
apache logs to the contrary) or the watchdog calls fail without error
(which would be crazy).  But only fail when the call is made via
javascript.  When made explicitly from the browser everything works as

BTW, the apache logs indicate the proper number of bytes is returned by
the request, and I've changed the size of the page returned to confirm
this - evidence that caching is not the cause of this.

Has anyone seen this or have any ideas?  Many thanks.


More information about the development mailing list