【问题标题】:Can't get WordPress to write error messages to the debug log无法让 WordPress 将错误消息写入调试日志
【发布时间】:2020-04-20 13:17:00
【问题描述】:

我无法让 WordPress 将错误消息写入调试日志。
在我的wp-config.php 中,我有:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

我将wp-content 的权限设置为777,并将debug.log(我创建的)的权限设置为666,但仍然没有运气。
WP_DEBUG_DISPLAY 设置为true 确实会显示错误,ini_set('display_errors', 1); 等也会显示错误,但永远不会写入日志。
使用error_log 函数也不起作用。

这可能是什么原因,我该如何解决这个问题?

【问题讨论】:

    标签: php linux wordpress


    【解决方案1】:

    对我来说,这是一个令人讨厌的简单问题 - 它实际上是在写入日志,但我看错了地方。确保不仅要检查 WordPress 根目录,还要检查 wp-adminwp-includes,尤其是 wp-content 文件夹中的错误日志文件。

    默认为the error log is set to wp-content/error.log,但您可以使用wp-config.php中的以下行更改它

    define( 'WP_DEBUG_LOG', '/some-path/error-file.log' );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多