4

We're having a problem with our log detail page (/admin/reports/event/XXXXXX):

enter image description here

As you can see, the content is blank. There are no apparent errors in the Apache logs. View source shows that the entire page HTML is rendering properly, there's just nothing in the content div. Watchdog messages are showing up in the Recent Log Messages page (/admin/reports/dblog), it's just that when we click on one to get more detail, we get the blank detail page.

The details page was working a couple of weeks ago, and we haven't made any configuration changes since then. We had to restart Apache and MySQL recently, but I don't see why that would cause this.

Tried disabling and re-enabling the Database Logging module.

Any suggestions?

1
  • 1
    check error_reporting and display_errors in php.ini
    – Aboodred1
    Apr 16, 2013 at 18:39

5 Answers 5

8


Check if there are a user with uid=0 in users database table.
If not, just add a new row with 0 uid and it'll resolve the problem.
Good luck!

3
  • Exactly this was the problem in my case. I have no idea how the user 0 was deleted Sep 23, 2015 at 21:59
  • Wow, I can't believe this fixed it. Amazing find, Maher Sakka!
    – WebMW
    Apr 19, 2017 at 1:06
  • +1 I wonder how did you know this. Sep 7, 2018 at 12:39
1

I got this problem when running automated tests, which create a temporary user, and then delete that user. There seems to be a problem with how watchdog handles messages that were produced by no-longer existent users. They display as owned by "Anonymous," but have a link that includes a parameter of a now-nonexistent UID.

enter image description here

1

I've struggled with this problem forever and after searching for about the 20th time for a quick fix I found this thread and decided to just hack a solution. I know this is a cardinal sin in the Drupal world but the offending function isn't hookable. Please don't kill me!

The problem appears to be something to do with errors that are created by an anonymous user. Watchdog entries reference the offending user. But if no UID is present the query finds nothing = empty error page. That's because the query performs an INNER JOIN on the user table, rather than a LEFT JOIN. So I went into the dblog.admin.inc file, found the dblog_event() function and added this just after the initial query on line 154:

if(!$result){
$result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w LEFT JOIN {users} u ON w.uid = u.uid WHERE w.wid = :id', array(':id' => $id))->fetchObject();
drupal_set_message(t('For whatever reason the user information was not logged with the watchdog entry so the user information might not be accurate.'));
}

Or you could just change the original query from an INNER JOIN to a LEFT JOIN...or the total fail safe: remove the user information entirely from the query.

No, that fix doesn't use the DB API but neither does the original query. Maybe some kind soul can submit a patch to the core team since this is such a critical feature for many admins.

For the record I'm using a Postgres 9.2.6 database, Drupal 7.26, PHP 5.3.10, Apache 2.2.22.


Edit: So, after five years returning to this page every time Drupal released an update, I finally decided to follow the direction in the top response (rather than my quick hack). For those wondering, here's what I did.

  1. Created a new user with the username 'anonymous' and a fake email address. I set the new user as 'blocked'.
  2. I don't have access to a nice database admin tool so I used the 'Execute PHP Code' option in the Development menu to run this little code snippet:

    $query = db_query("UPDATE {users} SET uid = '0' WHERE name = 'anonymous'"); if($query == 1) { drupal_set_message('User Updated'); }

Permanent problem solution. Yay.

2
  • 1
    Although the dblog_event() is not hookable, you could override the path with hook_menu_alter and create your own function. It is what the watchdog_event_extras module does to implement a dblog_event function that is hookable.
    – 2pha
    Nov 18, 2014 at 13:42
  • Your hint - "Problem has something to do with anonymous users" helped me a great deal..Thank you! Feb 24, 2015 at 16:33
0

If you have Drush installed, you can use the watchdog-show command to view the details of the watchdog messages, which should give you an idea of why the details aren't showing up.

Alternatively, you can use a mysql client to query the watchdog table in the database, to see the details of the watchdog messages. The watchdog entries can be a bit difficult to read because they typically use a lot of token replacement during output, but you should be able to get an idea of the main error that's causing the problems with the log detail pages. The following query outputs the 5 most recent watchdog entries and might be enough to get you started:

SELECT * FROM watchdog ORDER BY wid DESC LIMIT 5\G;
0

If you getting blank page when you reach dblog page (admin/reports/dblog) then try drush delete wachdog

watchdog:delete (wd-del, wd-delete, wd) or shortcut drush wd all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.