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 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 is a little bit clearer, lets look at some 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.

  • TIMES

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

    The following list of 6 Wrapper log files were generated using the ROLLNUM token in the log file name and the SIZE roll mode. The log file "wrapper.log.4" was modified after the fact in an editor which caused its modified time to be set to a later value.

    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-30 10:00:00)  <- Modified in an editor
    logs/wrapper.log.5  (2009-12-26 10:55:03)

    When sorted, the files will be in the following order:

    Log File List (Sorted):
    logs/wrapper.log.4  (2009-12-30 10:00:00)  <- Modified in an editor
    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:

    Log File List (Preserved files):
    logs/wrapper.log.4  (2009-12-30 10:00:00)  <- Modified in an editor
    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. The order will be in increasing order.

    The following list of 6 Wrapper log files were generated using the ROLLNUM token in the log file name and the SIZE roll mode. The log file "wrapper.log.4" was modified after the fact in an editor which caused its modified time to be set to a later value.

    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-30 10:00:00)  <- Modified in an editor
    logs/wrapper.log.5  (2009-12-26 10:55:03)

    When sorted, the files will be in the following order. Note that the modified time of the modified log file is ignored:

    Log File List (Sorted):
    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 in an editor
    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:

    Log File List (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. The order will be in decreasing order.

    The following list of 6 Wrapper log files were generated using the ROLLNUM token in the log file name and the SIZE roll mode. The log file "wrapper.log.4" was modified after the fact in an editor which caused its modified time to be set to a later value.

    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-30 10:00:00)  <- Modified in an editor
    logs/wrapper.log.5  (2009-12-26 10:55:03)

    When sorted, the files will be in the following order. Note that the modified time of the modified log file is ignored:

    Log File List (Sorted):
    logs/wrapper.log.5  (2009-12-26 10:55:03)
    logs/wrapper.log.4  (2009-12-30 10:00:00)  <- Modified in an editor
    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:

    Log File List (Preserved files):
    logs/wrapper.log.5  (2009-12-26 10:55:03)
    logs/wrapper.log.4  (2009-12-30 10:00:00)  <- Modified in an editor
    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