WordPress调试 [英] WordPress debugging
本文介绍了WordPress调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从WordPress插件编写调试消息?
How can I write debug messages from my WordPress plugin?
在WordPress中进行调试 描述了如何我可以启用 wp-content/debug.log
文件.但是我该怎么写呢?是否有诸如 wp_log($ msg)
之类的日志记录方法?我没有找到.
Debugging in WordPress describes how can I enable the wp-content/debug.log
file. But how can I write to it? Is there any logging method like wp_log($msg)
or something? I didn't find such.
推荐答案
如果 WP_DEBUG_LOG
设置为true,则error_log
-INI设置已设置:
If WP_DEBUG_LOG
is set to true, the error_log
-INI setting is set:
ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
要写入该文件,可以使用 error_log
-function :
To write to that file, you can use the error_log
-function:
error_log("This message is written to the log file");
此功能不是特定于WordPress的,可以在任何PHP脚本中使用.
This function is not specific to WordPress and can be used in any PHP script.
这篇关于WordPress调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文