Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/sudo-wp/sudowp-log-viewer/archive/refs/heads/main.zipSecurity Notice: The original Log Viewer plugin by Markus Fischbacher was closed on WordPress.org on February 21, 2022 due to a security issue. No patch was released by the original author. This fork addresses the identified vulnerabilities and modernizes the codebase for PHP 8.0+ compatibility.
SudoWP Log Viewer is a security-hardened fork of the abandoned Log Viewer WordPress plugin. It provides an easy way to view *.log files directly in the WordPress admin panel.
Features
- View any
.logfile inwp-content/from the WordPress admin Tools menu - File actions: delete, empty, or append a break separator to log files
- Autorefresh: automatically reload the page every 15 seconds (configurable per-user)
- FIFO/FILO display order preference
- File size and last modified time shown in the UI
- Optional Debug Bar panel integration
Security Patches in This Fork
- Stored XSS fix: All log file content output is now escaped with
esc_html()to prevent JavaScript injection via crafted log entries - Path traversal fix: File selection is validated against a strict allowlist of discovered
.logfiles, withrealpath()boundary enforcement - Debug statement removal: Removed
var_dump()/die()block that broke all file actions and leaked server paths - Authorization hardening: Added
current_user_can( 'manage_options' )check to the Debug Bar panel render path - Access control fix: Replaced
is_super_admin()withcurrent_user_can( 'manage_options' )for consistent capability-based access control - JavaScript hardening: Replaced
setTimeoutstring eval with a proper function callback - PHP 8.0+ compatibility: Fixed fatal error caused by PHP 4-style parent constructor call in the Debug Bar panel class
- Clean uninstall: Plugin now removes all user settings from
wp_optionson deletion
For the full audit report, see SECURITY_AUDIT_SUMMARY.md.
Installation
Important: Deactivate and delete the original Log Viewer plugin before installing this fork. Both plugins cannot be active at the same time.
- Upload the
sudowp-log-viewerfolder to/wp-content/plugins/. - Activate through the Plugins menu in WordPress.
- Navigate to Tools > Log Viewer to view log files.
To enable WordPress debug logging, add the following to your wp-config.php:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
Requirements
- WordPress 6.0 or higher
- PHP 8.0 or higher
Known Limitations
- Log file scanning is limited to
*.logfiles in the top level ofwp-content/. Subdirectories are not scanned. - The Debug Bar integration requires the Debug Bar plugin.
- Autorefresh interval is fixed at 15 seconds.
Changelog
1.2.0
- Feature: Redesigned admin UI - dark terminal-style layout with sidebar file list, toolbar, and file metadata status bar
- Feature: File action button only appears after selecting a specific action
- Feature: File size display in header and info bar
1.1.1
- Bug fix: Prevented fatal
TypeErroron sites with no log files present inwp-content/.view_page()and Debug Barrender()now guard againstfalsereturn fromgetCurrentFile()before callingtransformFilePath().
1.1.0
- Security: Fixed stored XSS via unescaped log file content output
- Security: Fixed path traversal via absolute path injection in file parameter
- Security: Removed
var_dump()/die()debug statement that broke file actions and leaked server paths - Security: Added capability check to Debug Bar panel render path
- Security: Replaced
is_super_admin()withcurrent_user_can( 'manage_options' ) - Hardening: Replaced
setTimeoutstring eval with function callback - Hardening: Fixed user option key construction inconsistency
- Hardening: Added proper
uninstall.phpcleanup forwp_optionsrecords - Compatibility: Fixed PHP 8.0 fatal error from PHP 4-style parent constructor call
- Compatibility: Added
declare(strict_types=1)to all PHP files - Compatibility: Declared all class properties with explicit types
License
GPL-2.0-or-later. See LICENSE.
Reporting Security Issues
See SECURITY.md for our security policy and reporting instructions.