Title: WP Debug Logger
Author: Donncha O Caoimh (a11n)
Published: <strong>2011 年 7 月 26 日</strong>
Last modified: 2016 年 12 月 9 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://s.w.org/plugins/geopattern-icon/wp-debug-logger.svg)

# WP Debug Logger

 作者：[Donncha O Caoimh (a11n)](https://profiles.wordpress.org/donncha/)

[下载](https://downloads.wordpress.org/plugin/wp-debug-logger.zip)

 * [详情](https://cn.wordpress.org/plugins/wp-debug-logger/#description)
 * [评价](https://cn.wordpress.org/plugins/wp-debug-logger/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/wp-debug-logger/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/wp-debug-logger/#developers)

 [支持](https://wordpress.org/support/plugin/wp-debug-logger/)

## 描述

This plugin logs the activity of supported plugins to a file, making it easier to
figure out why there’s a problem.

If you have been asked to install this plugin because of a support issue then installing
this plugin is just like installing any other plugin. Once installed, go to Settings-
>WP Logger and enable logging. If you have a number of supported plugins enable 
the one you are interested in.

Developers who want to use this plugin to add logging to their own plugin should
see the Developers section of this documentation.

Mark Jaquith’s [Monitor Pages](https://wordpress.org/extend/plugins/monitor-pages/)
plugin was used as a template for this plugin. Thanks Mark!

#### Developers

Other plugins can use this plugin to record important events which are then dumped
to a log file. Plugins must add the event to a global array in the following way:

    ```
    $GLOBALS[ 'wp_log' ][ 'name_of_plugin' ][] = 'Some important event';
    ```

Plugins must also add themselves to a list of enabled plugins. This will make it
easier for blog owners to filter out which plugin they want to debug on the settings
page. Add and edit the following code so it is executed when the plugin is loaded.

    ```
    $GLOBALS[ 'wp_log_plugins' ][] = 'name_of_plugin';
    ```

A hypothetical example might be a plugin (let’s call it “Big A”) that uses the output
buffer to change the letter “a” to “A”. The events recorded by this might include
the following:

    ```
    $GLOBALS[ 'wp_log' ][ 'big_a' ][] = 'Created output buffer';
    $GLOBALS[ 'wp_log' ][ 'big_a' ][] = 'Output buffer callback';
    $GLOBALS[ 'wp_log' ][ 'big_a' ][] = 'Replaced a with A in page';
    ```

This plugin takes the “wp_log” array and dumps it to a file in the upload directory
of the blog it’s activated on. The file is linked from the plugin settings page 
and can be deleted on that page too. The file is a simple text file and is not protected
in any way so be careful if auth cookies are logged by a plugin.

A “log” function isn’t included but if you want to add one to your plugin check 
the constant WP_DEBUG_LOG is defined before adding to the log array. If your plugin
doesn’t use a class make sure that you call the log function a unique name so it
doesn’t conflict with other plugins.

    ```
    function log( $message ) {
        if ( defined( 'WP_DEBUG_LOG' ) )
            $GLOBALS[ 'wp_log' ][ 'name_of_plugin' ][] = $message;
    }
    ```

## 安装

 1. Upload the `wp-debug-logger` folder to your `/wp-content/plugins/` directory
 2. Activate the “WP Debug Logger” plugin in your WordPress administration interface
 3. Go to Settings → WP Debug Logger as an Administrator to get started

## 评价

此插件暂无评价。

## 贡献者及开发者

「WP Debug Logger」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Donncha O Caoimh (a11n) ](https://profiles.wordpress.org/donncha/)
 *   [ Automattic ](https://profiles.wordpress.org/automattic/)

[帮助将「WP Debug Logger」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/wp-debug-logger)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/wp-debug-logger/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/wp-debug-logger/)，或通过[RSS](https://plugins.trac.wordpress.org/log/wp-debug-logger/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/wp-debug-logger/)。

## 更新日志

#### 0.1

Initial Release

## 额外信息

 *  版本 **0.1**
 *  最后更新：**9 年前**
 *  活跃安装数量 **10+**
 *  WordPress 版本 ** 2.9.2 或更高版本 **
 *  已测试的最高版本为 **4.7.33**
 *  语言
 * [English (US)](https://wordpress.org/plugins/wp-debug-logger/)
 * 标签
 * [debug](https://cn.wordpress.org/plugins/tags/debug/)[development](https://cn.wordpress.org/plugins/tags/development/)
   [log](https://cn.wordpress.org/plugins/tags/log/)[php](https://cn.wordpress.org/plugins/tags/php/)
 *  [高级视图](https://cn.wordpress.org/plugins/wp-debug-logger/advanced/)

## 评级

尚未提交反馈。

[Your review](https://wordpress.org/support/plugin/wp-debug-logger/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/wp-debug-logger/reviews/)

## 贡献者

 *   [ Donncha O Caoimh (a11n) ](https://profiles.wordpress.org/donncha/)
 *   [ Automattic ](https://profiles.wordpress.org/automattic/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/wp-debug-logger/)