[WordPress] 外掛分享: WP Debug Logger

前言介紹

  • 這款 WordPress 外掛「WP Debug Logger」是 2011-07-25 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2016-12-09,距離現在已有 3071 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 2.9.2 以上版本才可以安裝。
  • 尚未有人給過這款外掛評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

donncha | automattic |

外掛標籤

log | php | debug | development |

內容簡介

這個外掛將支援的其他外掛的活動記錄到檔案中,讓您更容易找出問題所在。

如果有支援人員讓您安裝此外掛以解決問題,那麼安裝這個外掛就像安裝其他外掛一樣。安裝後,前往「設定」-> 「WP Logger」並啟用日誌紀錄。如果有多個支援的外掛,啟用您有興趣的那個外掛。

想使用這個外掛來為您自己的外掛添加日誌紀錄的開發人員應該參閱本文檔的「開發人員」部分。

本外掛的範本是 Mark Jaquith 的 Monitor Pages 外掛。非常感謝 Mark!

開發人員

其他外掛可以使用這個外掛來記錄重要事件,然後將這些事件傾倒到日誌檔案中。外掛需要將事件添加到全域陣列中,方式如下:

$GLOBALS[ 'wp_log' ][ '外掛名稱' ][] = '某些重要事件';

外掛還必須加入啟用的外掛清單。這樣,部落格所有者就可以在設定頁面上更輕鬆地過濾他們想要進行調試的外掛。添加和編輯以下代碼,以在外掛加載時執行。

$GLOBALS[ 'wp_log_plugins' ][] = '外掛名稱';

一個假想的例子可能是一個使用輸出緩衝區將字母 "a" 更改為 "A" 的外掛(讓我們稱之為 "Big A")。這個外掛記錄的事件可能包括以下內容:

$GLOBALS[ 'wp_log' ][ 'big_a' ][] = '建立輸出緩衝區';
$GLOBALS[ 'wp_log' ][ 'big_a' ][] = '輸出緩衝區回調';
$GLOBALS[ 'wp_log' ][ 'big_a' ][] = '在頁面中將 a 替換為 A';

此外掛接受 "wp_log" 陣列,然後將其傾印到上傳目錄中的檔案中。檔案在外掛設定頁面有連結,也可以在該頁面上刪除。這個檔案是一個簡單的文字檔案,並沒有任何保護措施,因此如果外掛記錄了 auth cookies,要小心一些。

如果您想為您的外掛添加一個 "log" 函式,請先檢查常數 WP_DEBUG_LOG 是否已定義,然後再添加到日誌類別中。如果您的外掛沒有使用類別,請確保您調用的日誌函式具有唯一名稱,以免與其他外掛衝突。

function log( $message ) {
if ( defined( 'WP_DEBUG_LOG' ) )
$GLOBALS[ 'wp_log' ][ '外掛名稱' ][] = $message;
}

原文外掛簡介

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 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;
}

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「WP Debug Logger」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


最新版本

延伸相關外掛(你可能也想知道)

  • Check & Log Email – Easy Email Testing & Mail logging 》需要一個工具,讓你可以輕鬆地記錄和查看 WordPress 發送的所有電子郵件嗎? Check & Log 可能就是此問題的解決方案。, 此 WordPress 外掛可幫助你為審計目的...。
  • Email Log 》Email Log 是一個 WordPress 外掛,可以輕鬆地記錄和查看所有從 WordPress 發送的電子郵件。, 這在調試 WordPress 網站中與電子郵件相關的問題或存儲發送的電...。
  • WordPress Sentry 》此外掛可選擇性地報告 PHP 錯誤和 JavaScript 錯誤至 Sentry,同時與其發布追蹤整合。, 它會自動偵測已驗證的使用者並在可能的情況下加入內容。所有內容/標籤...。
  • User Activity Log 》你的網站上有多個使用者進行各種後台活動嗎?你有沒有遇到追蹤網站後台使用者活動的問題?你想通過追蹤所有使用者活動來保護你的網站嗎?你想在特定使用者登...。
  • Audit Trail 》Audit Trail 是一個 WordPress 外掛,用於追蹤您的部落格內的活動記錄。透過記錄特定操作(例如誰在什麼時候登入),並以日誌的形式儲存此信息,不僅如此,它...。
  • Log cleaner for Solid Security 》在 2018 年初,iThemes 刪除了手動刪除資料庫日誌的功能(詳見此主題)。本外掛讓您重新獲得此控制權。, 支援, 在官方 WordPress 庫中,iThemes Security 日...。
  • Simple Login Log 》這是一個記錄使用者登入的簡單日誌外掛,可追蹤使用者名稱、登入日期、IP 地址和瀏覽器使用者代理。 , DEMO 影片, 功能包括:, , 能夠過濾使用者名稱、成功/...。
  • Dashboard Widgets Suite 》插件名稱:Dashboard Widgets Suite(控制面板小工具套裝), , 該外掛提供 1 個插件與 9 個小工具,可簡化您的工作流程並提高工作效率。該套裝小工具包括以下...。
  • Register IPs 》 垃圾郵件是一回事,但惡意留言和假帳戶卻另當別論。有時候,有些人會決定成為爛人並創建多個帳戶來騷擾您的誠實用戶。此外掛可幫助您通過記錄創建時使用的 I...。
  • Debug Log – Manager Tool 》這是一個簡單的除錯日誌外掛程式,您可以在儀表板中檢查除錯日誌。透過一個點擊,您可以啟用或停用除錯功能(例如 ‘ WP_DEBUG’、‘WP_DEBUG...。
  • MJ Update History 》MJ Update History 外掛可以記錄並顯示 WordPress 外掛、佈景主題和核心的更新歷史紀錄,並支援以列表或其他格式(如CSV、文字檔)輸出。。
  • Logbook 》安裝並啟用插件後,您可以檢查以下活動。, 功能, , 超輕量化,不會影響網站性能。, 已通過 100 多種模式單元測試,您可以放心地在企業中使用。, 可擴展事件保...。
  • Log HTTP Requests 》記錄並查看所有 WP HTTP 請求, 核心、外掛或佈景主題更新檢查運行需要多長時間?我的網站發送了哪些數據?所有這些 AJAX 請求怎麼辦?這些問題的答案只需點擊...。
  • Cron Logger 》你有沒有好奇過你的 WordPress 在 wp-cron.php 中在做什麼?現在你可以看到了。這個外掛可以紀錄每個排程。, 其他訊息。
  • Smart External Link Click Monitor [Link Log] 》Smart External Link Click Monitor (前身為 Link Log) 外掛能夠追蹤您的訪客點擊哪些外部連結。, 數據存儲在您的伺服器上,無需外部服務。, 使用方法, Link ...。

文章
Filter
Apply Filters
Mastodon