[英]Php errors not logging for wordpress plugins
When I have a php error in a wordpress plugin or theme on my localhost, it doesn't output to my Apache error log. 当我在本地主机上的wordpress插件或主题中出现php错误时,它不会输出到我的Apache错误日志中。
This is not the case for php files that I have in my www/ directory; 我的www /目录中的php文件不是这种情况; those seem to log just fine, as do errors from the wordpress core.
这些似乎很好,wordpress核心的错误也是如此。 This also seems to be the case on other servers as well.
在其他服务器上似乎也是如此。
Any thoughts as to what might be causing this? 关于什么可能导致这种情况的任何想法?
WP_DEBUG_LOG
is companion toWP_DEBUG
that causes all errors to also be saved to adebug.log
log file inside the/wp-content/
directory.WP_DEBUG_LOG
是WP_DEBUG_LOG
的伴侣,WP_DEBUG
导致所有错误也都保存到/wp-content/
目录中的debug.log
日志文件中。 This is useful if you want to review all notices later or need to view notices generated off-screen (eg during an AJAX request orwp-cron
run).如果您想稍后查看所有通知或需要查看屏幕外生成的通知(例如在AJAX请求或
wp-cron
运行期间),此功能将非常有用。
Edit your wp-config.php
file and add the following definition (if not already present): 编辑您的
wp-config.php
文件并添加以下定义(如果尚不存在):
define('WP_DEBUG_LOG', true);
This will make Wordpress log the errors to /wp-content/debug.log
. 这将使Wordpress将错误记录到
/wp-content/debug.log
。
However, if you want to change the location of the debug.log
file, you can use the following work-around: 但是,如果要更改
debug.log
文件的位置,则可以使用以下解决方法:
if (defined('WP_DEBUG_LOG') && WP_DEBUG_LOG) {
ini_set( 'error_log', WP_CONTENT_DIR.'/foo/debug.log' ); //modify accordingly
}
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.