Clear log file with backup

From TNG_Wiki
Jump to: navigation, search
Clear log file with backup
Summary Adds a button to Backup / Clear the log file to the Access Log display
Validation {{{mod_validation}}}
Mod Updated {{{mod_last_update}}}
Download link (for TNG V8) (for TNG V7)
Download stats {{{download_stats}}}
Author(s) Jim Graham
Homepage Clear log file with backup (This page)
Mod Support TNG Community Forums
Contact Developer {{{mod_contact}}}
Latest Mod 8.1.0 for TNG V8
1.2 for TNG V7
Min TNG V 7.0.0
Max TNG V 8.0.2
Files modified
Related Mods
Note that you should only install Clear log file with backup or Clear Log File

Purpose of the mod

This mod adds a Backup / Clear Log file button to the page in TNG that displays the access log. Clicking on the button makes a backup of the genlog.txt file then clears all of the entries from the log file.

The genlog.txt file is backed up in a directory called genlog_backup. The backup filename has the date and time appended to it.

e.g genlog_08_23_2009_09_04_20.txt

This shows that the file was backed up on 23rd August 2009 at 09:04:20.

Every time you clear the log file a backup will be made. The mod does not delete old backup files. These files remain in the backup folder until you delete them manually.

This mod applies to TNG 7.1.0 but should work with previous versions, although the line numbers may be different.

Alternative mod

There is a similar mod available which clears the log file but does not make a backup of the genlog.txt file. see Clear Log File for this mod.


This mod was developed by Jim Graham

Revision History

Version Date Contents
V8.1.0 3 November 2010 Updated for TNG V8
V1.2 23 December 2009 Fixed corruption in form action field
V1.1 23 December 2009 Updated the config file to change the added button to Backup / Clear log file to distinguish it from the alternative Clear Log File
V1.0.1 23 August 2009 Inserted code to close an opened file that had been omitted from version 1.0.0
V1.0.0 23 August 2009 Initial release


  • A working TNG installation. The automated installation release was tested on TNG Version 7.1.0.
  • A backup of your TNG showlog.php file.
  • An installed current version of the Mod Manager.

Automated Installation

  1. Download the for TNG V8 or TNG V7
  2. Extract the downloaded config file into your admin/mod_folder
  3. Follow the normal automated installation for Mod Manager, as shown in the example Mod Manager - Installing Config Files to install the Clear_log_file_with_backup.cfg.

Visualization of this mod

The image on the right shows the added Backup / Clear log file button to the TNG Access Log display.

Backup Clear Log file.jpg

In the event of a problem

  • Try using the Mod Manager Remove capability
  • Or copy your backup of showlog.php file to your TNG directory
    • all should now work correctly