log和debug相关设置
show all errors by adding a few lines to your local testing site’s settings.php:
123error_reporting(E_ALL);ini_set('display_errors', TRUE);ini_set('display_startup_errors', TRUE);navigate to Configuration > DEVELOPMENT > Logging and errors (admin/config/development/logging) and select “All messages”.
激活Debug mode
激活后,drupal会禁用cache,js和css聚合,修改error_log为详细级别等拷贝文件到sites/default/
1cp sites/example.settings.local.php sites/default/settings.local.php放开sites/default/settings.php中以下内容
123if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {include $app_root . '/' . $site_path . '/settings.local.php';}
开启Twig templates debug
sites/default/services.yml123twig.config:debug: trueauto_reload: true开启Render API cache debug
sites/default/settings.local.php123$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';$settings['cache']['bins']['render'] = 'cache.backend.null';$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';Switch on strict PHP error reportingcheck through your php.ini file and set error reporting to E_ALL | E_STRICT.
log
网站不能访问
查看apache log
1tail -f 'C:\Program Files (x86)\DevDesktop\apache\logs\error.log'drush watch dog
1drush wd-show --tail通过syslog module 查看logsyslog需要关闭dblog,不适用于开发时使用
- 网站可以访问
- 通过dblog module查看系统事件log
Your site captures system events in a log to be reviewed by an authorized individual at a later time. The log is a list of recorded events containing usage data, performance data, errors, warnings, and operational information. It is vital to check the log on a regular basis as it is often the only way to tell what is going on.
You can find your site’s recent log messages in the Manage administrative menu by navigating to Reports > Recent log messages (admin/reports/dblog).
- 通过dblog module查看系统事件log
debug tools
参考资源
Show all errors while developing
Database Logging module overview
Syslog module overview
Debugging Twig templates
drupal-8-debugging-techniques