Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check Drupal log files?

How can I check Drupal log files?

I'm using Ubuntu 10.10 + Apache2 + PHP 5.33 + MySQL and Drupal 7.

like image 681
manish nautiyal Avatar asked Jun 21 '11 06:06

manish nautiyal


People also ask

What is Watchdog Drupal?

Developers familiar with Drupal 7 will also be familiar with watchdog(), an API function that allows you to create a log message that appears on the Reports page in the Drupal administrative UI. Implementing D7's hook_watchdog allows module developers to customize the destination of these log messages.

What is error Drupal?

An "Internal Server Error" is an error on the web server that you're trying to access. That server is misconfigured in some way that is preventing it from responding properly to what you're asking for. An "Internal Server Error" often occurs due to: Misconfigured Drupal core file or folder read and write permissions.


2 Answers

To view entries in Drupal's own internal log system (the watchdog database table), go to http://example.com/admin/reports/dblog. These can include Drupal-specific errors as well as general PHP or MySQL errors that have been thrown.

Use the watchdog() function to add an entry to this log from your own custom module.

When Drupal bootstraps it uses the PHP function set_error_handler() to set its own error handler for PHP errors. Therefore, whenever a PHP error occurs within Drupal it will be logged through the watchdog() call at admin/reports/dblog. If you look for PHP fatal errors, for example, in /var/log/apache/error.log and don't see them, this is why. Other errors, e.g. Apache errors, should still be logged in /var/log, or wherever you have it configured to log to.

like image 137
Charlie Schliesser Avatar answered Sep 20 '22 14:09

Charlie Schliesser


If you love the command line, you can also do this using drush with the watchdog show command:

drush ws

More information about this command available here:

https://drushcommands.com/drush-7x/watchdog/watchdog-show/

like image 39
Seven Avatar answered Sep 23 '22 14:09

Seven