53

On a development site I would suggest uncommenting the following lines in the settings.php file. emacs sites/default/settings.php if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php'; } and then copying the file example.settings.local.php from /sites folder to /sites/default folder and rename it to settings....


38

Use dpm($wrapper->getPropertyInfo()); It's in the docs.


35

Good god Batman. That was incredibly frustrating. Here's a guide to getting xhprof working. (Note: I am very new to Linux. I'm not sure if the permissions I use are safe, or whether there is a better way of doing it. I'd only do this on a test environment.) IMPORTANT: It won't tell you anything about how to interpret it. I have no idea how to, I'm just ...


33

The error: EntityMalformedException: Missing bundle property on entity of type node. happens, because your bundle property is malformed either on load or save, so Drupal can't find what type of bundle is it. The logic of that Exception is: // Explicitly fail for malformed entities missing the bundle property. if (!isset($entity->{$info['entity keys']...


29

This error comes from an uncaught PHP exception. Drupal catches exceptions so no ugly PHP error message is displayed to user. You can find the exception info in the 'Recent log messages' link on Reports (or try this path: /admin/reports/dblog). Make sure 'Database logging' module is enabled because this module provides this report. You will see all the ...


28

Make sure you have print $messages; in your page.tpl.phptemplate file. By default, devel (dpm) is configured to print it's content in the message area of the site. So if your template for some reason does not render the contents of $messages, you won't see anything.


28

Not really. Since Drupal 7.33 release there is now simple support for alternative template support and themeing function alternatives listing in Drupal (core) by adding a setting in settings.php. Added a "theme_hook_original" variable to templates and theme functions and an optional sitewide theme debug mode, to provide contextual information in the page'...


18

You can use the Devel module, and select one of the "Krumo Backtrace" options it provides in its configuration page at admin/config/development/devel. Make sure to visit admin/config/development/logging and select "Errors and Warnings" or "All Messages". If you have the Syslog module, or any other logging module enabled, you may need to disable it and ...


18

Add the following line in the settings.php file. $config['system.logging']['error_level'] = 'verbose'; See Make developer tricks / tools for D8 more discoverable/obvious for more details.


16

Drupal 6 & 7 If using Drush, just do drush vset error_level 1. Otherwise, go to "/admin/config/development/logging" and change the setting to "Errors and Warnings" Drupal 8 Instead of drush vset/vget/vdel, you can use cset/cget/cdel for config values and sset/sget/sdel for state values.


15

EASY WAY for Drupal 8, if you can't login anymore to access the recent log messages as described in the accepted answer. Open the file /sites/default/settings.php with an editor or ftp client and add this line: $config['system.logging']['error_level'] = 'verbose'; After reloading the page you will see a full error message, instead of the generic “The ...


15

An easy option, if you have access to Drupal Console, is to enable the development/debugging environment using drupal site:mode dev; when you are ready to change it back to production, use drupal site:mode prod.


14

Sometimes krumo($variable) might work when dpm($variable) doesn't. Sometimes print dpm($variable) might work when dpm($variable) doesn't. might also be the solution when there's no print $messages in your page.tpl.php anymore. Maybe you can add it back.


14

Rather than rolling your own hook_query_alter() you can let Devel module do the heavy lifting for you by adding the debug tag: $q = new EntityFieldQuery; $q->entityCondition('entity_type', 'node'); ->addTag('debug') ->execute(); This will print the query to screen, just like dpq() would.


14

EASY WAY Edit your settings.php and add a line there (especially on your dev site, you can just keep this on) $conf['error_level'] = 1; drush requires you being able to bootstrap the database.


14

What is easiest way to debug variables in nodes,views,blocks and page template. Using Devel Kint, which comes with the Devel module. Welcome to Kint 101 Important: in order to use kint() in a twig file you need to enable debugging for twig. If you're not debugging inside a twig/template file, you can skip this part. If you have Drupal Console installed ...


13

Give them Access developer information permission at admin/people/permissions. Note that this opens a huge security risk so make sure you revoke it when you are done with debugging.


12

I agree with the comment left for the question: It seems you have an out of memory issue. Check the error log for the server. I had the same problem with dump() and kint() in an implementation of template_preprocess_views_view_field(), while trying to output the content of a row, on a clean and fresh Drupal 8 installation. I found a workaround for kint(), ...


11

Someone tried to create a module to provide shell access from within a Drupal site, but it was never fully debugged. See the Drupal Terminal project. Perhaps there have been advances in the jQuery terminal that might make it easier to get this working if someone revisited it. If you want to exec Drush from within php, it is generally better to use ...


11

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


11

You can apply |render|striptags|trim twig filters: <a href="{{ fields.path.content|render|striptags|trim }}" class="menu-item">{{ fields.title.content }}<span data-background-image="{{ fields.field_image.content|render|striptags|trim }}"></span></a> If you want to save (not delete) for example div or img tags you can also write: ...


10

dpm() does not print any protected properties and it also doesn't know about methods. That's especially bad for content entities but applies to most objects in 8.x now. The issue referenced in the answer from Daniel Wehner adds Kint, which is already much better, as it will give you protected properties and methods. However, for content entities, it still ...


10

You can put this in your settings.php $conf['theme_debug'] = true; This outputs html comments on your page which will help you with debugging how the theme suggestions are selected.


10

Option 1: Use the Disable Messages module Use the Disable Messages module for this. Here is a quote from its project page: Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal ...


9

I'd highly recommend devel_debug_log. It requires the devel module, and it gives you the ddl() function. ddl adds a page to your reports in configuration, so it's similar to printing to watchdog, but you have a nice clean page where you can send your debug messages, and not worry about race-type conditions where your messages might get cleared before you ...


9

You must be logged-in to the Drupal site, with the correct permissions to access Devel. Log in as admin should do it.


9

There's a big difference between creating a custom module for just one site (your own, let's say) and creating one that will be able to be used on many different sites. For example, let's say I want to limit access to a certain content type to only users of a certain role. Let's say that content type is 'awesome_thing' and the role is 'awesome_person'. ...


9

Here is the variable with the different values : $config['system.logging']['error_level'] = 'all'; // hide|some|all|verbose


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


9

Install the devel module and then Web Profile module which is bundled with it. You will then see the Symfony web profiler bar below the browser screen. Click on a Request gear icon, and it will show you the route and the controller class. You can start there. You can also search your code base for that route name and see, if there are additional cases when ...


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