Hi,

my watchdog keeps filling up with this notice.

Notice: Undefined index: devel in DatabaseLog->get() (line 80 of /home/wicked/public_html/dev/includes/database/log.inc).

does anyone else have this, or know whats causing it?

thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

salvis’s picture

If you're wicked enough then try enabling Devel's Backtrace Error Handler to find out where the call comes from.

There's a certain risk that this may result in WSODs (white screen of death). If you're not confident that you'll be able to recover, then don't try this.

chriz001’s picture

wicked enough, lol
Devel's Backtrace Error Handler is pretty cool :)

here is what it says:

get (Array, 7 elements)
getLog (Array, 6 elements)
devel_shutdown_real (Array, 2 elements)
call_user_func_array (Array, 4 elements)
_drupal_shutdown_function (Array, 2 elements)

it mentions line 964 in sites\all\modules\devel\devel.module which says:
$queries = Database::getLog('devel', 'default');

what should i look at next?
thanks!

chriz001’s picture

friendly bump :)

salvis’s picture

Category: support » bug

Sorry...

The call is http://api.drupal.org/api/drupal/includes--database--database.inc/functi...

      $queries = Database::getLog('devel', 'default');

in devel_shutdown_real(). This is ok, provided that

      Database::startLog('devel');;

has been called in devel_boot(), and the latter depends on devel_query_enabled().

Database::getLog()...

final public static function getLog($logging_key, $key = 'default') {
  if (empty(self::$logs[$key])) {
    return NULL;
  }
  $queries = self::$logs[$key]->get($logging_key);
  self::$logs[$key]->end($logging_key);
  return $queries;
}

... calls DatabaseLog::get('devel'):

public function get($logging_key) {
  return $this->queryLog[$logging_key];
}

This causes your warning. On my test site, getLog() above takes the first exit, but apparently it does not for you.

Have you activated some kind of database logging? Try turning it off and tell us what happens.

I would think that adding an additional condition to...

    if (isset($user) && user_access('access devel information')) {
      $queries = Database::getLog('devel', 'default');
      $output .= devel_shutdown_summary($queries);
      $output .= devel_shutdown_query($queries);
    }

in devel_shutdown_real() to make it look like

    if (isset($user) && devel_query_enabled() && user_access('access devel information')) {
      $queries = Database::getLog('devel', 'default');
      $output .= devel_shutdown_summary($queries);
      $output .= devel_shutdown_query($queries);
    }

should take care of your problem.

chriz001’s picture

Wow, such an awesome responce, thanks!

OK, if i turn off the database logging module, i still see the error at the bottom of every page with the Backtrace error handler enabled.

If i have the standard drupal error handler, with the database logging module disabled i dont see the error.

but if the database logging module is enabled, it gets the same entry every page view, at least from the admin account.

If i change the devel_shutdown_real() function as you suggested, everything works fine! :)

any idea why my drupal install is acting differently? seems a bit strange.

thankyou very much!

salvis’s picture

Status: Active » Needs review
FileSize
574 bytes

Search through your entire Drupal source code for Database::startLog( — maybe you find another module that starts a log?

Here's the patch.

chriz001’s picture

Hi,

I did the search and it comes up 7 times under the simpletest module and 2 times under the devel module, thats all.

Also i noticed that this patch stops the 'Display page timer' and 'Display memory usage' features of devel from working.

salvis’s picture

Seems like we won't find out why this behaves differently for you.

Here's an updated patch.

ogi’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #8 fixed the notice in my installation.

salvis’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

chriz001’s picture

Worked for me too, Thankyou!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sonicthoughts’s picture

Version: 7.x-1.x-dev » 7.x-1.3

I get this error - was this patch committed?

salvis’s picture

Yes

7adf608 - #1087156 by salvis: Fix notice in DatabaseLog->get() (2011-04-05 00:03:57 +0200) <salvis>

The changed line is line 1064 in the current D7 HEAD.

Please open a new issue and paste the full message that you get.

warmth’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Closed (fixed) » Active

I'm getting this issue today after enabling some cache, performance modules and Facebook developement tools:

Notice: Undefined index: devel in DatabaseLog->get() (line 79 of /home/MYSITE/www/SUBFOLDER/includes/database/log.inc).

jca’s picture

Version: 7.x-1.x-dev » 7.x-1.3

I'm still getting the same notice:

Notice: Undefined index: devel in DatabaseLog->get()

salvis’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Status: Active » Closed (fixed)

Please think again whether it makes sense to go back to the 2012-Jun-05 version and be surprised that it's still behaving like the 2012-Jun-05 version...

If you see this in the current -dev version, then follow #14.