Display Log Files for Zen Cart v1.5.0 to v1.5.4

Version 1.0.9 by lat9 & design75

Current Support Thread at Zen Cart Forums: http://www.zen-cart.com/showthread.php?204058-Display-Log-Files-Support-Thread

Version History:

What it does

There have been many times that I've taken a look in one of my Zen Cart's /logs (or /cache for Zen Cart v1.5.0) directories and found some debug log files that I wasn't previously aware of. This plugin allows an admin user to view (and selectively delete) any files with names that match:

The plugin searches only in these directories for the matching log-files:

Once installed (see below), the plugin can be accessed by a signed-in and authorized admin user by selecting Tools->Display Log Files. In addition, starting with v1.0.8, a message is shown in your admin's header if any myDEBUG-*.log files are found in the /logs directory, if defined, or the /cache directory otherwise.

Note: Due to the potentially sensitive nature of the information contained in some of the log files, I suggest that you run your admin in SSL mode if you use this plugin.

Due the the number of files that can accumulate, only the most recent 20 are displayed by default. If you want to display more files at a time, edit the file /YOUR_ADMIN/display_logs.php and change line 23:

  define('MAX_LOG_FILES_TO_VIEW', 20);

In addition, starting with v1.0.3, there's an additional constant (on line 24) that specifies the maximum number of bytes per file to read. Some of the log files can get very large and cause this plugin to generate a debug-log due to an out-of-memory condition!

    if (!defined('MAX_LOG_FILE_READ_SIZE')) define('MAX_LOG_FILE_READ_SIZE', 80000);  /*v1.0.3a*/

The tool allows the logged-in (and authorized) admin user to:

The initial screen for the tool looks similar to:

Sample output

Installation

There is one core-file overwrite in this plugin; you should always backup your cart’s database and files prior to making any changes. Unzip the plugin's package file, rename the YOUR_ADMIN folder to match your custom admin folder's name. Merge the core file YOUR_ADMIN/includes/header.php and then copy the contents of that admin folder to your store's installation:

  1. /YOUR_ADMIN/display_logs.php
  2. /YOUR_ADMIN/includes/header.php
  3. /YOUR_ADMIN/includes/extra_datafiles/display_logs_filenames.php
  4. /YOUR_ADMIN/includes/languages/english/display_logs.php
  5. /YOUR_ADMIN/includes/languages/english/extra_definitions/display_logs_name.php
  6. /YOUR_ADMIN/includes/languages/english/images/buttons/button_delete_all.gif
  7. /YOUR_ADMIN/includes/languages/english/images/buttons/button_delete_selected.gif

Uninstall

First, delete the files that were copied to your zen-cart installation's admin directories. Restore your backup up of then use your admin's Tools->Run SQL Patches to run the file display_logs_uninstall.sql.