29

You can use drush to do this: $ drush help | grep watchdog watchdog-delete Delete watchdog messages. watchdog-list Show available message types and severity levels. A (wd-list) prompt will ask for a choice to show watchdog messages. watchdog-show Show watchdog messages. drush watchdog-show has too many options to fully ...


10

You can use watchdog but the message part should be translatable, so any variables should use placeholders defined in the variables array. Check out format_string to see how these should work. watchdog( 'my_module_name', 'Here is the printed variable: <pre>@placeholder_name</pre>', array('@placeholder_name' => print_r( $my_variable, ...


9

You can do the following to output array data to be viewed in watchdog: // Directly use values. watchdog("log_name", '<pre>' . print_r( $my_object, true) . '</pre>'); Then goto /admin/reports and look for "log_name".


8

You should use field_info_fields(), which returns an array containing information about all the defined fields. Its output is similar to the following one.


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!


7

Without knowing what kinds of errors you are seeing, it is hard to say what to do. If this is a live site, then I suggest that you edit your settings.php to turn off PHP error reporting. IIRC, this will do it for you error_reporting(0); ini_set('display_errors', FALSE); ini_set('display_startup_errors', FALSE); or you could also edit your php.ini and do ...


7

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(...


7

Check out their http://example.com/admin/reports/dblog. You should have messages like this one: Type content Date Wednesday, June 5, 2013 - 09:11 User admin Location http://localhost/node/1/delete Referrer http://localhost/node/1/delete Message page: deleted test. For future, you can use hook_watchdog() This hook allows ...


6

Just change the setting to "ALL" that should work. Please see the screen below ! Cron will run only if minimum limit is set in the select box see the below code in dblog module. function dblog_cron() { // Cleanup the watchdog table. $row_limit = variable_get('dblog_row_limit', 1000); // For row limit n, get the wid of the nth row in descending wid ...


6

The "Recent log messages" is one of the submenu options located within admin/reports/dblog. It becomes available after the core module dblog (Database Logging) is enabled. If that core module is enabled, and it still isn't showing up, then it is probably because permission "View site reports" (within "System") has not been granted to the user trying to ...


5

Never flushing your Watchdog log via CRON or at least manually clearing the log every so often will eventually cause you problems. If you are on a dedicated or virtual Linux host consider using Syslog instead of Watchdog for your Drupal logging (available in both Drupal 6 and 7.) This will allow you to keep an unlimited and permanent log of your Drupal ...


5

This has nothing to do with Google Analytics or your Provider. Check /admin/config/system/statistics. This will populate your /admin/reports/hits.


5

What you are requesting will considerably slow your external script. Perhaps there are better alternatives to using drupal's watchdog function. To use watchdog function you will need to bootstrap drupal. $drupal_path = '/drupal/home'; // Create a constant DRUPAL_ROOT that // defines our path to the drupal install define('DRUPAL_ROOT', $drupal_path); // ...


5

That's not possible. For hooks to be executed, your module must be enabled. From the docs: To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and calls that hook in all enabled modules that implement it. Emphasis mine. Allowing modules to run code ...


5

There is no special hook for this. The easiest way to fix this in Drupal 8 is overriding logger.dblog service. According to the official documentation you need implement a class extending ServiceProviderBase and the alter() method as shown below. <?php namespace Drupal\example; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\...


5

Running cron happens automatically when someone visits your site by default. Drupal does that automatically once every few hours to run certain cleanup/background tasks. Additionally, cron jobs always run as anonymous user, that's why it is logged as that, even if you trigger it manually as admin.


5

Why Recent log message is showing anonymous user? because // Force the current user to anonymous to ensure consistent permissions on cron runs. You can see code here. $this->accountSwitcher->switchTo(new AnonymousUserSession()); Any current user will be switch to anonymous user. Anyone have cron url with token can run cron. You can find url ...


4

http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/watchdog/6 talks about the watchdog() call, and you access the reports it generates from admin/reports/dblog provided that you've turned on the optional Database Logging core module (dblog).


4

Unfortunately hook_watchdog doesn't provide a return value which could block the insertion of the log entry in the database. Note though that the responsible module for inserting the entry in the database is dblog. You could disable that and write your own implementation of it, although you'd have to replicate lots of functionality. Another idea is to have ...


4

cron.php initiates a call to function drupal_cron_run() (in common.inc) which will finally make all calls to all cron tasks. /** * Executes a cron run when called * @return * Returns TRUE if ran successfully */ function drupal_cron_run() { . . // Iterate through the modules calling their cron handlers (if any): module_invoke_all('cron'); // This will ...


4

You could actually log the details about user creation at hook_user_insert(), and deletion using hook_user_delete(). User creation: Acts on new user creation function MODULE_user_insert(&$edit, $account, $category) { watchdog('user', 'User created with ID: %userid', array('%userid' => $account->uid]), WATCHDOG_NOTICE, $link = NULL); } User ...


4

The 'Location' is the URL a user/process was visiting when the watchdog entry was invoked. The 'Referrer' is the URL that referred the user to the 'Location' URL. So if a person goes directly from a link on http://www.google.com to http://yoursite.com/, and visiting that URL on your site generates a watchdog record, the 'Location' will be '/', and the '...


4

Here are some modules to consider, for anybody who is not able or willing to write some PHP coding to answer such typical reporting question (or anybody who does not want to enable the PHP filter in a site): The Forena module can be used for such types of reporting. It comes with all sorts of Sample reports and solutions, such as the Site administration ...


4

The Views Watchdog module might be useful. The Views Watchdog module extends the Views module and allows to create customized lists (pages, blocks, feeds) of watchdog entries. Combine it with the Charts module and a bit of custom code and you should be able to get a wide array of reports.


4

You can use phpMyAdmin to export the watchdog table (or select entries) in csv format which excel can read. If you do not have access of database, you can use Views, Views Watchdog and Views data export modules to accomplish this.


4

watchdog() is not appropriate place for storage; the $variables parameter is for formatting the display of variable data (e.g. the USERNAME in "User USERNAME has logged in"), not for long term storage of application data. Instead, use a combination of hook_cron() and the persistent variable functions (variable_get() and variable_set()) to execute a cron ...


3

Keep in mind, the user module already creates watchdog log entries when a user is created or deleted: User created watchdog('user', 'New user: %name (%email).', array('%name' => $form_state['values']['name'], '%email' => $form_state['values']['mail']), WATCHDOG_NOTICE, l(t('edit'), 'user/' . $account->uid . '/edit')); in user_register_submit ...


3

You have to enable the Syslog module, and the log will be available in /var/log/drupal.log. For more information, you can read Syslog: OS-integrated logging.


3

Check to make sure you have the module "Database logging" turned on. THis is sometimes turned off for performance reasons.


3

If you have a look through the list of Drupal core functions that call watchdog(), you can get a good idea of the events that get logged. http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/calls/watchdog/7


Only top voted, non community-wiki answers of a minimum length are eligible