Display Log Files [Support Thread] (v1.5.1-to-v1.5.6)
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:
myDEBUG-*.log
AIM_Debug_*.log
SIM_Debug_*.log
FirstData_Debug_*.log
Linkpoint_Debug_*.log
Paypal*.log
paypal*.log
ipn_*.log
zcInstall*.log
notify*.log
The plugin searches only in these directories for the matching log-files:
/cache
/logs
/includes/modules/payment/paypal/logs
Once installed, the plugin can be accessed by a signed-in and authorized admin user by selecting Tools->Display Log Files.
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);
The tool allows the logged-in (and authorized) admin user to:
Sort the log files, either ascendingly or descendingly, by last-modified/creation date.
Select (via checkbox) and then delete only the log files selected.
Delete all log files currently being viewed.
View the contents of an individual log file.
It's been tested on Zen Cart v1.5.0 and v1.5.1 and will be submitted to the Plugins area for review today.
Re: Display Log Files [Support Thread]
Re: Display Log Files [Support Thread]
This will be a nice addition. Thank you :)
Re: Display Log Files [Support Thread]
It's now available in the plugins ... holy crow, that was fast!
Re: Display Log Files [Support Thread]
Re: Display Log Files [Support Thread]
Quote:
Originally Posted by
Rizla
Will it work for 1.3.9h
Sorry, it currently works on v1.5.0 and v1.5.1 only.
Re: Display Log Files [Support Thread]
Now that's doing it properly! Where do you find the time!
I also had a desire to know about debug logs when I caused them, so I made up something very basic to just push the logs in my face above the header...which may suit some people:
http://www.zen-cart.com/showthread.p...-Automatically
Re: Display Log Files [Support Thread]
Thanks for the compliment, Steve. I guess I just got tired of FTPing debug log files, so it's actually going to be a time-saver for me!
Re: Display Log Files [Support Thread]
Ok. I renamed my admin and uploaded the files. Getting a 500 server error. I do have a logs and cache directory, but I'm getting this error in my debugs:
PHP Warning: dir(DIR_FS_LOGS) [<a href='function.dir'>function.dir</a>]: failed to open dir: No such file or directory in /home/xxxxxx/ohwowthatscool.com/myadmin/display_logs.php on line 41
[23-Dec-2012 08:34:23] PHP Fatal error: Call to a member function read() on a non-object in /home/xxxxxx/ohwowthatscool.com/myadmin/display_logs.php on line 42
Any idea what the problem might be? The error reads like it is looking for function.dir.
(Running this on 1.5.1) White screen of death when I choose Display Logs from the admin menu, then it generates the debug in my cache folder.
Thanks.
Re: Display Log Files [Support Thread]
Quote:
Originally Posted by
jlizotte
Ok. I renamed my admin and uploaded the files. Getting a 500 server error. I do have a logs and cache directory, but I'm getting this error in my debugs:
PHP Warning: dir(DIR_FS_LOGS) [<a href='function.dir'>function.dir</a>]: failed to open dir: No such file or directory in /home/xxxxxx/ohwowthatscool.com/myadmin/display_logs.php on line 41
[23-Dec-2012 08:34:23] PHP Fatal error: Call to a member function read() on a non-object in /home/xxxxxx/ohwowthatscool.com/myadmin/display_logs.php on line 42
Any idea what the problem might be? The error reads like it is looking for function.dir.
(Running this on 1.5.1) White screen of death when I choose Display Logs from the admin menu, then it generates the debug in my cache folder.
Thanks.
The error message indicates that the constant DIR_FS_LOGS is not defined so that the PHP dir function is choking. Running on v1.5.1, you should have the DIR_FS_LOGS constant defined in both /YOUR_ADMIN/includes/configure.php and /includes/configure.php. I'm guessing that this was an upgrade to v1.5.1 for your site.
That said, the plugin shouldn't be giving you the white-screen-of-death. I don't seem to have an issue with or without the DIR_FS_LOGS constant on v1.5.1 because the Zen Cart init handlers 'fix' it. It's another story on v1.5.0, however, where I'm seeing what you're seeing.
Make the changes highlighted in red to /YOUR_ADMIN/display_logs.php, starting at line 39:
Code:
foreach(array(DIR_FS_LOGS, DIR_FS_SQL_CACHE, DIR_FS_CATALOG . '/includes/modules/payment/paypal/logs') as $logFolder) {
$logFolder = rtrim($logFolder, '/');
$dir = @dir($logFolder);
if ($dir != NULL) {
while ($file = $dir->read()) {
if ( ($file != '.') && ($file != '..') && substr($file, 0, 1) != '.') {
if (preg_match('/^(myDEBUG-|AIM_Debug_|SIM_Debug_|FirstData_Debug_|Linkpoint_Debug_|Paypal|paypal|ipn_|zcInstall).*\.log$/', $file)) {
$hash = sha1 ($logFolder . '/' . $file);
$logFiles[$hash] = array ( 'name' => $logFolder . '/' . $file,
'mtime' => filemtime($logFolder . '/' . $file)
);
}
}
}
}
I'll hold off on resubmission to the Plugins for a bit, just in case ...