Index

wrapper.logfile.purge.sort

Compatibilidad :3.3.8
Ediciones :Edición ProfesionaEdición EstándarEdición de la Comunidad
Plataformas :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_SMART:

    to cause the files to be sorted based on their names. The files will be sorted according to the dates and roll numbers included in their names.

  • NAMES_ASC (Deprecated as of 3.5.37):

    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 (Deprecated as of 3.5.37):

    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 NAMES_SMART. Prior to version 3.5.37, the default value was TIMES (except when rolling by date where NAMES_DEC was used).

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_SMART:

    The log files are sorted based on their names taking into account the date and index they contain. The sorting order will be by descending dates and ascending roll numbers, to make sure that the oldest files will always be purged before the newer ones.

    File name sorted by dates and roll numbers:
    logs/wrapper_20181203.log  (Current log file)
    logs/wrapper_20181202.log
    logs/wrapper_20181202.log.1
    logs/wrapper_20181202.log.2
    logs/wrapper_20181202.log.3
    logs/wrapper_20181201.log
    

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

    Preserved files:
    logs/wrapper_20181203.log  (Current log file)
    logs/wrapper_20181202.log
    logs/wrapper_20181202.log.1
    logs/wrapper_20181202.log.2
    

    NOTA

    Unlike the TIMES mode, this method is not affected by file edits.

  • NAMES_ASC (Deprecated as of 3.5.37):

    ADVERTENCIA

    Use of this value has been deprecated as of Wrapper version 3.5.37 in favor of the NAMES_SMART which make it possible to sort log files taking into account both dates and roll numbers included in their names. For backward compatibility, NAMES_ASC will continue to work as it used to, but NAMES_SMART should always be preferred.

    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 (Deprecated as of 3.5.37):

    ADVERTENCIA

    Use of this value has been deprecated as of Wrapper version 3.5.37 in favor of the NAMES_SMART which make it possible to sort log files taking into account both dates and roll numbers included in their names. For backward compatibility, NAMES_DEC will continue to work as it used to, but NAMES_SMART should always be preferred.

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

    The sort mode of NAMES_DEC makes little when sorting files containing only a roll number. 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  (Current log file)
    logs/wrapper-20091229.log
    logs/wrapper-20091228.log
    logs/wrapper-20091227.log
    logs/wrapper-20091226.log
    logs/wrapper-20091225.log
    

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

    Preserved files:
    logs/wrapper-20091230.log  (Current log file)
    logs/wrapper-20091229.log
    logs/wrapper-20091228.log
    logs/wrapper-20091227.log
    

Referencia: Archivo de Registro