4.6 Demonstrate ability to analyze and resolve site performance issues arising from site configurati

Review admin logs and status reports. Review how to write to the logging API.

The Logging system will help monitor a site to report any problems. Navigate to /admin/reports/dblog

The Status report on the site also provides valuable information about site configuration. Navigate to /admin/reports/status.

A site admin can also configure what type of errors to display on a page. Error messages should never be displayed on a production site.

From the command line drush status will also provide the same valuable information.

drush @site-alias status
drush @site-alias ws

Drush ws will also print out messages to the terminal.

Use core's development debugging tools

Drupal 8 ships with an example.settings.local.php. Inside this file there are lots of debugging goodies. For example, turning off caching, increasing your error levels and enabling local services.

In this file there are examples of how to set the display error level to verbose

$config['system.logging']['error_level'] = 'verbose';

Sometime a page can be caching and causing an error, disable cache and clear the page cache.

/**
* Disable CSS and JS aggregation.
*/
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

Writing to logging API

When writing custom modules you can write to the logging API. For example

\Drupal::logger('my_module')->error($message);
$logger->log($level, $message);

Other Resources