Change record status: 
Project: 
Introduced in branch: 
9.5.x
Introduced in version: 
9.5.0
Description: 

A new debug setting has been added to make it easier to debug render caching. This setting will add cache debugging output for each rendered element.

You can debug render cache by setting the debug container parameter to true under renderer.config in your services.yml or development.services.yml file.

  renderer.config:
    required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
    auto_placeholder_conditions:
      max-age: 0
      contexts: ['session', 'user']
      tags: []
    debug: true

With debugging enabled, each rendered element will be wrapped with HTML comments like so:

<!-- START RENDERER -->
<!-- CACHE-HIT: No -->
<!-- CACHE TAGS:
   * node:1
   * node_view
   * user:1
   * user_view
-->
<!-- CACHE CONTEXTS:
   * languages:language_interface
   * theme
   * timezone
   * url.site
   * user.permissions
   * user.roles
   * user.roles:anonymous
   * user.roles:authenticated
-->
<!-- CACHE KEYS:
   * entity_view
   * node
   * 1
   * full
-->

<article data-history-node-id="1" data-quickedit-entity-id="node/1" role="article" class="contextual-region node node--type-page node--
...
</article>

<!-- END RENDER -->
Impacts: 
Module developers
Themers

Comments

bardiuk’s picture

drupal disable renderer cache debug output

drupal disable cache hit info

drupal disable cache-contexts debug info

Add this to your development.services.yml

parameters:
  renderer.config:
    debug: false
    required_cache_contexts: [ 'languages:language_interface', 'theme', 'user.permissions' ]
    auto_placeholder_conditions:
      max-age: 0
      contexts: [ 'session', 'user' ]
      tags: [ ]
norman.lol’s picture

debug: true

anybody’s picture

Seems like just adding

renderer.config:
    debug: true

is not enough and it needs all the lines from the example.

I think that's not perfect DX and a bit confusing (please read this as positive criticism). What I'd expect as developer new to Drupal is just to set a flag to enable debugging, but that seems to lead to exceptions?

With all the lines, it works!

http://www.DROWL.de || Professionelle Drupal Lösungen aus Ostwestfalen-Lippe (OWL)
http://www.webks.de || webks: websolutions kept simple - Webbasierte Lösungen die einfach überzeugen!
http://www.drupal-theming.com || Individuelle Responsive Themes