Title: RP Debug Log Viewer
Author: Rahul Prajapati
Published: <strong>ሓምለ 5, 2026</strong>
Last modified: ሓምለ 18, 2026

---

Search plugins

![](https://ps.w.org/rp-debug-log-viewer/assets/banner-772x250.png?rev=3596347)

![](https://ps.w.org/rp-debug-log-viewer/assets/icon-256x256.png?rev=3596347)

# RP Debug Log Viewer

 By [Rahul Prajapati](https://profiles.wordpress.org/rahuliprajapati/)

[Download](https://downloads.wordpress.org/plugin/rp-debug-log-viewer.1.1.0.zip)

 * [Details](https://tir.wordpress.org/plugins/rp-debug-log-viewer/#description)
 * [Reviews](https://tir.wordpress.org/plugins/rp-debug-log-viewer/#reviews)
 *  [Installation](https://tir.wordpress.org/plugins/rp-debug-log-viewer/#installation)
 * [Development](https://tir.wordpress.org/plugins/rp-debug-log-viewer/#developers)

 [Support](https://wordpress.org/support/plugin/rp-debug-log-viewer/)

## Description

**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 Levels** — `INFO`, `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.

## Screenshots

[⌊Log Viewer — Dark-themed tabbed viewer with per-level color-coded badges, collapsible
context blocks, and a search toolbar.⌉⌊Log Viewer — Dark-themed tabbed viewer with
per-level color-coded badges, collapsible context blocks, and a search toolbar.⌉[

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

[⌊Array / Object Dump — Large PHP arrays and objects displayed as an expandable,
syntax-highlighted JSON tree with a top-level key summary.⌉⌊Array / Object Dump —
Large PHP arrays and objects displayed as an expandable, syntax-highlighted JSON
tree with a top-level key summary.⌉[

**Array / Object Dump** — Large PHP arrays and objects displayed as an expandable,
syntax-highlighted JSON tree with a top-level key summary.

[⌊Configuration — Color pickers, font size, panel height/width controls, live preview,
and drag-and-drop tab management with active/inactive toggles.⌉⌊Configuration — 
Color pickers, font size, panel height/width controls, live preview, and drag-and-
drop tab management with active/inactive toggles.⌉[

**Configuration** — Color pickers, font size, panel height/width controls, live 
preview, and drag-and-drop tab management with active/inactive toggles.

## Installation

 1. Upload the `rp-debug-log-viewer` folder to the `/wp-content/plugins/` directory,**
    or** install directly from the WordPress plugin repository via **Plugins -> Add
    New** and search for “RP Debug Log Viewer”.
 2. Activate the plugin through the **Plugins** screen in WordPress.
 3. Navigate to **RP Debug Log Viewer** in the admin sidebar to open the Log Viewer.
 4. (Optional) Visit **RP Debug Log Viewer -> Generate Sample Logs** to populate demo
    log files and explore the viewer immediately.
 5. Start logging from your theme or plugin code using `rp_dlv_info()`, `rp_dlv_warning()`,`
    rp_dlv_error()`, or `rp_dlv_debug()`.
 6. (Optional) Open **RP Debug Log Viewer -> Snippets** to add PHP debug snippets —
    or one-click add a Ready-Made Debug Snippet such as the `rp_trace()` variable inspector.

## FAQ

### Do I need to create the log file manually?

No. Calling any `rp_dlv_*()` function with a new log name automatically creates 
the file, registers it in the database, and adds it as a tab in the viewer. You 
can also create log files manually from the Log Viewer page using the “Create Custom
Log File” form.

### Where are log files stored?

In `wp-content/uploads/rp-debug-log-viewer/`. Each file is named `<log-name>.log`.
The directory is protected from direct browser access with an `.htaccess` file and
an `index.php` guard.

### Is the WordPress debug.log supported?

Yes. The `debug` log is pre-registered and appears as the first tab in the viewer.
It reads from the standard `wp-content/debug.log` file, and you can view, search,
and download it like any other log. It cannot be cleared or deleted through the 
plugin, since `wp-content/debug.log` is owned by WordPress core and lives outside
the plugin’s own storage directory — this plugin never writes to it. To clear it,
disable and re-enable `WP_DEBUG_LOG` in `wp-config.php`, or clear it manually via
your host’s file manager or SSH.

### Can I disable logging for a specific log file?

Yes. Go to **RP Debug Log Viewer -> Configuration -> Tab Management** and toggle
the log to **Inactive**. All `rp_dlv_*()` calls targeting that log will be silently
skipped until it is re-activated. The log file itself is preserved — only new writes
are paused.

### Does this plugin slow down my site?

No. RP Debug Log Viewer is designed for zero frontend impact:

 * CSS and JavaScript are loaded only on the plugin’s own admin pages — never on
   the frontend or on unrelated admin screens.
 * Log writes use `file_put_contents()` with `FILE_APPEND`, which is a single fast
   I/O operation.
 * No external API calls, no remote assets, and no background processes.

### Is it safe to use in production?

Yes — with care. Toggle verbose debug logs to **Inactive** in Configuration so `
rp_dlv_debug()` calls are skipped without touching your code. Keep `info` and `error`
level logs active for ongoing monitoring. Avoid logging passwords, credit card numbers,
or other sensitive personal data.

### Can I log from inside a Composer package or mu-plugin?

Yes, as long as RP Debug Log Viewer is loaded before your code runs. Hooking into`
plugins_loaded` at priority 10 or later is the safest approach for plugins. For 
mu-plugins, the logging functions are available after all regular plugins have loaded.

### What are Snippets and when should I use them?

Snippets are small pieces of PHP code you write and manage from **RP Debug Log Viewer-
> Snippets** — no FTP, no functions.php edits. Use them for hooks, filters, actions,
debugging helpers, temporary custom code, or testing a new feature before it goes
into your theme or plugin. Only snippets marked **Active** are executed; everything
else just sits safely in the database. Snippets run on every page load during `plugins_loaded`,
so anything you’d normally put in functions.php works the same way.

### Is it safe to run PHP snippets? What if I save broken code?

You can’t save broken code. Before a snippet is saved or activated, its code is 
run through PHP’s own parser (without being executed). If there is a syntax error,
the save is rejected and you see the exact problem and line number. If an already-
active snippet fails at runtime (for example, it calls a function that doesn’t exist),
the error is caught, the snippet is automatically deactivated so it cannot crash
subsequent requests, and an admin notice shows you what went wrong and where. As
an emergency brake, adding `define( 'RP_DLV_SNIPPETS_SAFE_MODE', true );` to `wp-
config.php` disables all snippet execution instantly while keeping your snippets
stored. Snippet management requires the `manage_options` capability (administrators
only), and every action is nonce-protected.

### Can snippets contain CSS, JavaScript, or HTML?

The Snippets feature is intentionally PHP-only and focused on WordPress debugging
and development. If you need to output CSS or JavaScript, you can still do it the
WordPress way from a PHP snippet — for example, by hooking `wp_enqueue_scripts` 
or `wp_head`.

### Can I use this plugin alongside other debugging plugins?

Yes. RP Debug Log Viewer does not modify WordPress constants like `WP_DEBUG` or `
WP_DEBUG_LOG`. It operates independently using its own log files and does not conflict
with Query Monitor, Debug Bar, or any other debugging tool.

### What happens when I delete the plugin?

All plugin data is cleaned up automatically: the custom database table is dropped,
plugin options are removed, and all log files in `wp-content/uploads/rp-debug-log-
viewer/` are deleted. No orphaned data is left behind.

### What PHP version is required?

PHP 7.4 or higher. PHP 8.0, 8.1, 8.2, 8.3, and 8.4 are fully supported.

### Is this plugin translation-ready?

Yes. All UI strings use WordPress internationalization functions with the `rp-debug-
log-viewer` text domain. A `.pot` file can be generated with WP-CLI: `wp i18n make-
pot . languages/rp-debug-log-viewer.pot`.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“RP Debug Log Viewer” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ Rahul Prajapati ](https://profiles.wordpress.org/rahuliprajapati/)

[Translate “RP Debug Log Viewer” into your language.](https://translate.wordpress.org/projects/wp-plugins/rp-debug-log-viewer)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/rp-debug-log-viewer/),
check out the [SVN repository](https://plugins.svn.wordpress.org/rp-debug-log-viewer/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/rp-debug-log-viewer/)
by [RSS](https://plugins.trac.wordpress.org/log/rp-debug-log-viewer/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.1.0

 * NEW: Snippets — create and manage PHP code snippets for WordPress debugging and
   development directly from the admin panel (RP Debug Log Viewer -> Snippets).
 * NEW: Snippet list view with Active/Inactive toggle, Edit, Clone, and Delete actions—
   newest snippets shown first.
 * NEW: Snippet editor with PHP syntax highlighting (WordPress core CodeMirror, 
   with a plain-textarea fallback) and an in-form Status toggle.
 * NEW: PHP syntax validation before every save and activation — invalid code is
   rejected with a clear error message and line number; broken snippets are never
   stored.
 * NEW: Runtime crash protection — a snippet that throws while running is caught,
   auto-deactivated, and reported via an admin notice with the error and line.
 * NEW: `RP_DLV_SNIPPETS_SAFE_MODE` wp-config.php constant as an emergency kill 
   switch that disables all snippet execution.
 * NEW: Ready-Made Debug Snippets — six one-click samples built on the plugin’s 
   own logging helpers: `rp_trace()` variable inspector, 404 logger, request performance
   monitor, user login logger, post-save data dumper, and outgoing email logger.
   Samples are always added Inactive for review first.
 * NEW: Snippets database table (`wp_rp_dlv_snippets`), created automatically on
   update and removed on uninstall.
 * FIX: Log Viewer placeholder messages (“No entries”, “Loading…”, “Log cleared.”)
   were invisible on dark viewer backgrounds — they now use a dedicated style that
   follows your configured viewer text color.
 * Security: all snippet actions are nonce-protected and restricted to administrators(`
   manage_options`); snippet code is stored via prepared statements and escaped 
   on output.

#### 1.0.0

 * Initial public release.
 * Named log files with automatic creation from code or admin UI.
 * Log Viewer with tabbed interface, instant search, one-click refresh, secure download,
   and clear.
 * Four log levels: INFO, WARNING, ERROR, DEBUG — each color-coded.
 * Structured JSON context blocks (collapsible, syntax-highlighted).
 * Array and object dump rendering with expandable full-tree view and top-level 
   key summary.
 * Built-in WordPress debug.log viewer tab (view, search, and download only — the
   plugin never writes to, clears, or deletes `wp-content/debug.log`, since it is
   owned by WordPress core and lives outside the plugin’s storage directory).
 * Configuration page: background, text, and hover colors; font size; panel height
   and width with live preview.
 * Tab management: drag-and-drop ordering and active/inactive toggle.
 * Generate Sample Logs page for quick testing.
 * Developer Resources page with PHP code examples.
 * Conditional asset loading (CSS/JS only on plugin pages).
 * Nonce-protected AJAX and secure log file download.
 * Filesystem hardening: log names are sanitized with `sanitize_file_name()` and`
   basename()`, then every read/write path is re-validated with `realpath()` to 
   stay contained within `wp-content/uploads/rp-debug-log-viewer/`.
 * Clean uninstall with full data removal.
 * WordPress coding standards compliant.
 * Translation-ready with `rp-debug-log-viewer` text domain.

## Meta

 *  Version **1.1.0**
 *  Last updated **11 ስዓት ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 6.2 or higher **
 *  Tested up to **7.0.2**
 *  PHP version ** 7.4 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/rp-debug-log-viewer/)
 * Tags
 * [code-snippets](https://tir.wordpress.org/plugins/tags/code-snippets/)[debug](https://tir.wordpress.org/plugins/tags/debug/)
   [developer-tools](https://tir.wordpress.org/plugins/tags/developer-tools/)[error log](https://tir.wordpress.org/plugins/tags/error-log/)
   [log viewer](https://tir.wordpress.org/plugins/tags/log-viewer/)
 *  [Advanced View](https://tir.wordpress.org/plugins/rp-debug-log-viewer/advanced/)

## Ratings

No reviews have been submitted yet.

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

[See all reviews](https://wordpress.org/support/plugin/rp-debug-log-viewer/reviews/)

## Contributors

 *   [ Rahul Prajapati ](https://profiles.wordpress.org/rahuliprajapati/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/rp-debug-log-viewer/)