RP Debug Log Viewer
RP Debug Log Viewer

RP Debug Log Viewer

0/5 (0 ratings) — active installs Updated Jul 18, 2026
<strong>Log Viewer</strong> — Dark-themed tabbed viewer with per-level color-coded badges, collapsible context blocks, and a search toolbar.

<strong>Log Viewer</strong> — Dark-themed tabbed viewer with per-level color-coded badges, collapsible context blocks, and a search toolbar.

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. And with the built-in PHP Snippets manager, you can drop in hooks, filters, and temporary debugging code straight from the admin panel — no FTP, no functions.php edits, no extra snippet plugin. 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.

PHP Snippets — Run Debug Code Without Another Plugin

The Snippets page lets administrators create and manage small PHP snippets for WordPress debugging and development:

  • Create, edit, clone, activate/deactivate, and delete snippets from a clean list view — newest first, each with a one-click status toggle.
  • Only Active snippets run. Inactive snippets are stored safely in the database and never executed.
  • Syntax validation before every save. The code is parsed (never executed) with PHP’s own parser. If there is a syntax error, the snippet is not saved and you get a clear message with the exact line number.
  • Crash protection at runtime. If an active snippet throws an error while running, it is caught, the snippet is automatically deactivated, and an admin notice shows the error and line — your site keeps working.
  • Emergency kill switch. Add define( 'RP_DLV_SNIPPETS_SAFE_MODE', true ); to wp-config.php and all snippet execution stops instantly.
  • Code editor with PHP highlighting powered by the CodeMirror editor bundled in WordPress core — no external libraries.
  • Ready-made debug snippets. Six one-click samples built on this plugin’s own logging helpers — including an rp_trace() helper that dumps any variable into the Log Viewer from anywhere in your code, a 404 logger, a request performance monitor, login/email/post-save loggers — each added Inactive so you can review the code first.

Snippets are PHP-only by design and run on every page load (during plugins_loaded) while active — ideal for hooks, filters, actions, debugging functions, temporary custom code, and testing new features.

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.
  • PHP Snippets Manager — Create, edit, clone, activate/deactivate, and delete PHP snippets from the admin panel. Perfect for hooks, filters, debugging helpers, and temporary custom code — without editing theme files or installing a separate snippets plugin.
  • Snippet Syntax Validation — Every snippet is checked with PHP’s real parser before it can be saved or activated. Broken code is rejected with a clear error message and line number, so it never reaches your site.
  • Snippet Crash Protection — A snippet that fails at runtime is trapped, automatically deactivated, and reported via an admin notice — plus a RP_DLV_SNIPPETS_SAFE_MODE constant acts as an instant kill switch for all snippets.
  • Ready-Made Debug Snippets — Six one-click sample snippets wired to the plugin’s own logging functions: a global rp_trace() variable inspector, 404 logger, request performance monitor, user login logger, post-save data dumper, and outgoing email logger.
  • 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.