plugin-icon

RP Debug Log Viewer

作者:Rahul Prajapati·
Create custom debug log files, capture rich error context, and fix WordPress bugs fast — right from your admin dashboard.
版本
1.0.0
最后更新
Jul 5, 2026
RP Debug Log Viewer

Stop drowning in one messy debug.log file. RP Debug Log Viewer turns chaotic WordPress debugging into a fast, focused workflow — right inside your admin dashboard. Create custom log files for any feature — payments, APIs, cron jobs, custom code — and capture rich context with every entry: error codes, file names, line numbers, and more. A beautiful, color-coded log viewer lets you scan, search, and filter entries instantly, so you spot exactly what broke and where — in seconds, not hours. Toggle, download, or clear any log in one click. Whether you’re a developer hunting a stubborn bug, a researcher analyzing patterns, or a site owner who just wants answers, RP Debug Log Viewer makes debugging effortless, organized, and genuinely enjoyable.

Why Use RP Debug Log Viewer?

  • Organized debugging — Stop scrolling through thousands of unrelated lines. Each concern gets its own log file and its own tab.
  • Structured data — Attach arrays and key-value context to every log entry. See user IDs, order totals, API endpoints, and execution times right alongside the message.
  • Visual clarity — Color-coded log levels (INFO, WARNING, ERROR, DEBUG), collapsible JSON blocks, and syntax highlighting make it easy to spot problems fast.
  • Zero configuration — Call one function, and the log file is created automatically. No setup, no config files, no terminal commands.
  • Production safe — Toggle any log file to Inactive and all logging calls to that file are silently skipped. No code changes needed.
  • Privacy first — Log files are stored server-side in a protected directory. No data is sent to external servers. No third-party services. No tracking.

Who Is This For?

  • Plugin developers debugging hooks, filters, and API integrations.
  • Theme developers tracking template rendering, custom queries, and asset loading.
  • Agency developers troubleshooting client sites without SSH access.
  • WooCommerce developers tracing payment gateways, order flows, and cart behavior.
  • Site administrators monitoring cron jobs, user activity, and background processes.
  • Anyone who has ever wished error_log() was more organized.

Key Features

  • Named Log Files — Create unlimited custom log files from the admin UI or automatically via code. Each file gets its own tab in the viewer.
  • 4 Log LevelsINFO, WARNING, ERROR, DEBUG — each color-coded with distinctive badges so you can scan logs at a glance.
  • Structured Context Data — Attach any associative array alongside your log message. Context is displayed as a collapsible, syntax-highlighted JSON block below the message.
  • Array and Object Dumps — Pass any PHP array or object directly as the message. It is automatically serialized to JSON and displayed in an expandable tree with a top-level key summary — perfect for inspecting $_POST, WooCommerce carts, or user objects.
  • Built-in Log Viewer — A dark-themed, terminal-style viewer with per-log tabs, instant search, one-click refresh, secure download, and clear (for your custom logs). No need to SSH into the server or open files in a text editor.
  • WordPress debug.log Support — The standard wp-content/debug.log file is automatically available as a built-in, read-only tab, so you can view and search PHP errors and WordPress notices alongside your custom logs. To keep the plugin from writing outside its own directory, this tab supports view, search, and download only — it is never modified or cleared by the plugin.
  • Search and Filter — Instantly search within any log file to find specific entries, error messages, or keywords.
  • Drag and Drop Tab Ordering — Reorder your log tabs by dragging them in the Configuration page. Your preferred order is saved automatically.
  • Active / Inactive Toggle — Pause logging to any file without deleting it or changing your code. When a log is inactive, all rp_dlv_*() calls targeting it are silently skipped.
  • Secure File Download — Download any log file to your computer through a nonce-protected admin endpoint. Files are never exposed via a public URL.
  • Display Customization — Choose your preferred background color, text color, hover highlight color, font size, panel height, and width. A live preview shows your changes before you save.
  • Generate Sample Logs — A dedicated page lets you populate demo log files with realistic entries (covering all four log levels plus array dumps) so you can test the viewer, search, and theme settings immediately after installation.
  • Developer Resources Page — Built-in documentation with copy-paste PHP code examples covering basic logging, context data, array dumps, hook integration, API debugging, WooCommerce events, exception handling, and performance profiling.
  • Conditional Asset Loading — CSS and JavaScript are loaded only on RP Debug Log Viewer’s own admin pages. Zero impact on the rest of your admin or your site’s frontend.
  • Clean Uninstall — When you delete the plugin, all database tables, options, and log files are removed automatically. No orphaned data left behind.
  • Translation Ready — Every UI string uses WordPress internationalization functions with the rp-debug-log-viewer text domain.
  • WordPress Coding Standards — Follows WPCS, sanitizes all inputs, escapes all outputs, verifies nonces on every action, and checks capabilities on every request.

Quick Start (3 Steps)

Step 1. Install and activate the plugin.

Step 2. Add a log call anywhere in your PHP code:

rp_dlv_info( 'my-plugin', 'User registered successfully', [ 'user_id' => 42 ] );

Step 3. Open RP Debug Log Viewer in your admin sidebar and click the tab for your log file. That’s it.

Available Functions

Five global helper functions are available as soon as the plugin is active:

rp_dlv_info( $log_name, $message, $context = [] ) rp_dlv_warning( $log_name, $message, $context = [] ) rp_dlv_error( $log_name, $message, $context = [] ) rp_dlv_debug( $log_name, $message, $context = [] ) rp_dlv_log( $log_name, $message, $level = 'info', $context = [] )
  • $log_name — The name of your log file (without .log). If it does not exist, it is created automatically.
  • $message — A string, array, or object. Arrays and objects are automatically serialized to JSON.
  • $context — An optional associative array of extra data displayed alongside the message.

Real-World Examples

Log a user login: add_action( ‘wp_login’, function( $login, $user ) { rp_dlv_info( ‘auth’, ‘Login: ‘ . $login, [ ‘id’ => $user->ID ] ); }, 10, 2 );

Log a remote API call: $response = wp_remote_get( $url ); if ( is_wp_error( $response ) ) { rp_dlv_error( ‘api’, $response->get_error_message(), [ ‘url’ => $url ] ); } else { rp_dlv_info( ‘api’, ‘Success’, [ ‘status’ => wp_remote_retrieve_response_code( $response ) ] ); }

Log WooCommerce payment events: add_action( ‘woocommerce_payment_complete’, function( $order_id ) { rp_dlv_info( ‘woocommerce’, ‘Payment complete’, [ ‘order_id’ => $order_id ] ); } );

Dump a full PHP array for inspection: $cart = WC()->cart->get_cart(); rp_dlv_debug( ‘woocommerce’, $cart );

Measure execution time: $start = microtime( true ); $result = heavy_import(); rp_dlv_info( ‘import’, ‘Finished’, [ ‘elapsed_ms’ => round( ( microtime(true) – $start ) * 1000, 2 ) ] );

How Log Files Are Stored

Custom log files are stored in wp-content/uploads/rp-debug-log-viewer/. The directory is automatically protected:

  • An .htaccess file blocks direct HTTP access to all log files.
  • An index.php file prevents directory listing.
  • Log files can only be viewed or downloaded through the authenticated admin interface.

The standard WordPress debug.log (in wp-content/) is also viewable, searchable, and downloadable as a built-in tab — but it is never written to, cleared, or deleted by this plugin, since that file lives outside the plugin’s own directory and is owned by WordPress core.

Security

  • All AJAX handlers verify a nonce and require the manage_options capability (administrator only).
  • Log file names are sanitized with sanitize_file_name() and basename(), then re-validated against a canonicalized (realpath()) allow-list so a request can never resolve outside wp-content/uploads/rp-debug-log-viewer/ — even via directory traversal or symlink tricks.
  • Every filesystem write (create, append, clear, delete) is restricted to wp-content/uploads/rp-debug-log-viewer/. The plugin never writes to, clears, or deletes wp-content/debug.log; that file is read-only within the plugin.
  • All other user inputs are sanitized using sanitize_text_field(), sanitize_hex_color(), and absint().
  • All outputs are escaped using esc_html(), esc_attr(), and esc_url().
  • Log file downloads go through a nonce-protected admin_init handler — files are never served via a public URL.
  • The log directory is protected against direct browser access with .htaccess and index.php guards.
  • Database queries use $wpdb->prepare() with parameterized placeholders.
免费基于付费套餐
通过安装,您同意 WordPress.com 服务条款第三方插件条款
目前已测试版本
WordPress 7.0
这个插件是可用的下载,适用于您的站点。