World Map
Java Service Wrapper is the easiest way to make your product more reliable.
  • Free Trial
  • Buy Now
wrapper.logfile.purge.sort Property

Index

wrapper.logfile.purge.sort

Compatibility :3.3.8
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM z/Linux

This property controls the way existing log files are sorted with the pattern matching when deciding which ones to purge. It can be used in combination with the sort pattern which has been manually configured only while the wrapper.logfile.maxfiles property has been set.

Valid sort modes include:

  • TIMES:

    to cause the files to be sorted based on their modified times. The order will be newest to oldest.

  • NAMES_ASC:

    to cause the files to be sorted based on their names. The order will be in increasing order. Numbers in the names are treated as numbers, and will be sorted accordingly.

  • NAMES_DEC:

    to cause the files to be sorted based on their names. The order will be in decreasing order. Numbers in the names are treated as numbers, and will be sorted accordingly.

The default value is TIMES.

Example:
wrapper.logfile.purge.sort=TIMES

Usage Example of Sort Modes:

To make each mode a little bit clearer, please look at the following examples. In all cases, files are sorted as explained above. The first N files will be preserved, where N is the value of the wrapper.logfile.maxfiles property. Any remaining files will be purged.

Here is the list of files used in the following examples. The following list of 5 Wrapper log files were generated using the ROLLNUM token in the log file name and the SIZE roll mode.

Log File List:
logs/wrapper.log.1  (2009-12-29 22:59:40)
logs/wrapper.log.2  (2009-12-29 05:45:35)
logs/wrapper.log.3  (2009-12-27 15:23:18)
logs/wrapper.log.4  (2009-12-27 10:00:00)
logs/wrapper.log.5  (2009-12-26 10:55:03)

After the files have been generated, someone modified the log file "wrapper.log.4", causing its modified date to be set to a later value.

Modification of wrapper.log.4:
logs/wrapper.log.1  (2009-12-29 22:59:40)
logs/wrapper.log.2  (2009-12-29 05:45:35)
logs/wrapper.log.3  (2009-12-27 15:23:18)
logs/wrapper.log.4  (2009-12-30 10:00:00)  <- Modified file
logs/wrapper.log.5  (2009-12-26 10:55:03)
  • TIMES:

    The log files are sorted oldest to newest using the modified date of the files.

    Files sorted by date:
    logs/wrapper.log.4  (2009-12-30 10:00:00)
    logs/wrapper.log.1  (2009-12-29 22:59:40)
    logs/wrapper.log.2  (2009-12-29 05:45:35)
    logs/wrapper.log.3  (2009-12-27 15:23:18)
    logs/wrapper.log.5  (2009-12-26 10:55:03)

    If wrapper.logfile.maxfiles property is set to 3, then the following files will remain after the purge:

    Preserved files:
    logs/wrapper.log.4  (2009-12-30 10:00:00)
    logs/wrapper.log.1  (2009-12-29 22:59:40)
    logs/wrapper.log.2  (2009-12-29 05:45:35)
  • NAMES_ASC:

    The log files are sorted based on their names in ascending order.

    File name sorted in ascending order:
    logs/wrapper.log.1  (2009-12-29 22:59:40)
    logs/wrapper.log.2  (2009-12-29 05:45:35)
    logs/wrapper.log.3  (2009-12-27 15:23:18)
    logs/wrapper.log.4  (2009-12-30 10:00:00)
    logs/wrapper.log.5  (2009-12-26 10:55:03)

    If wrapper.logfile.maxfiles property is set to 3, then the following files will remain after the purge:

    Preserved files:
    logs/wrapper.log.1  (2009-12-29 22:59:40)
    logs/wrapper.log.2  (2009-12-29 05:45:35)
    logs/wrapper.log.3  (2009-12-27 15:23:18)
  • NAMES_DEC:

    The log files are sorted based on their names in descending order.

    File name sorted in descending order:
    logs/wrapper.log.5  (2009-12-26 10:55:03)
    logs/wrapper.log.4  (2009-12-30 10:00:00)
    logs/wrapper.log.3  (2009-12-27 15:23:18)
    logs/wrapper.log.2  (2009-12-29 05:45:35)
    logs/wrapper.log.1  (2009-12-29 22:59:40)

    If wrapper.logfile.maxfiles property is set to 3, then the following files will remain after the purge:

    Preserved files:
    logs/wrapper.log.5  (2009-12-26 10:55:03)
    logs/wrapper.log.4  (2009-12-30 10:00:00)
    logs/wrapper.log.3  (2009-12-27 15:23:18)

    Effective Use of NAMES_DEC:

    The sort mode of NAMES_DEC makes little sense for the example above, and it's more commonly used with filenames containing dates or timestamps, as those files should be sorted in decreasing order to purge the oldest files:

    Log File List (effective use of Decreasing Order):
    logs/wrapper-20091230.log
    logs/wrapper-20091229.log
    logs/wrapper-20091228.log
    logs/wrapper-20091227.log
    logs/wrapper-20091226.log
    logs/wrapper-20091225.log

Reference: logfile