Index

wrapper.logfile.purge.pattern

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

WARNING

Unless you are doing one of the specific usage examples below, you will most likely NOT want to use this property. Be careful when doing so as it is very possible to delete files other than log files if you are not careful.

This property controls the file pattern to purge old log files. Every time when the log file is rolled and when a new log file is generated, all files matching the specific pattern will be selected and sorted using the sort mode. All available files will be queried and sorted with the specified mode, and files that exceed the maximum number of log files will be deleted.

The Pattern and Sort will be available only when the maximum number of log files has been set to a non-zero value.

Example:
wrapper.logfile.purge.pattern=../logs/wrapper-*.log*

Usage Example: Log files including the Wrapper's PID

Some users have requested the ability to do include the Wrapper's PID in log file to make it possible to run more than one instance of the Wrapper from the same directory.

Example Configuration:
wrapper.logfile=../logs/wrapper-%WRAPPER_PID%.log
wrapper.logfile.purge.pattern=../logs/wrapper-*.log*
wrapper.logfile.purge.sort=TIMES
wrapper.logfile.rollmode=SIZE_OR_JVM
wrapper.logfile.maxsize=10m
wrapper.logfile.maxfiles=10

Each of the properties in the example were used as follows:

  • wrapper.logfile :

    Following the log file setting, log files will be generated with file names including the Wrapper's PID.

  • wrapper.logfile.purge.pattern :

    The pattern to purge files is specified here. In this example, only the files whose names include 'wrapper-' and '.log' are going to be purged.

  • wrapper.logfile.purge.sort :

    As the PIDs included in the file names are not sequential, sorting by their name would not result in what you expect. So, the log files are sorted by their modification time (TIMES).

  • wrapper.logfile.rollmode :

    Following the rolling mode (SIZE_OR_JVM), log files will be rolled automatically whenever the JVM is restarted or the log file size grows to the maximum size. When the log file is rolled, ".1" and ".2" will be appended by the Token "ROLLNUM".

  • wrapper.logfile.maxsize :

    The maximum size of log files is set to "10MB".

  • wrapper.logfile.maxfiles :

    The maximum number of rolled files is set to "10". A maximum of 10 files will be preserved besides the current file.

The following is a list of files which could exist, shown in their sorted order based on modification time (.purge.sort=TIMES). Note the fact that the PIDs are not sequential relative to time.

Example Log Files:
wrapper-31832.log  (Current file)
wrapper-31832.log.1
wrapper-31832.log.2
wrapper-8643.log
wrapper-13062.log
wrapper-13062.log.1
wrapper-13062.log.2
wrapper-13062.log.3
wrapper-11523.log
wrapper-11523.log.1
wrapper-11523.log.2 (Oldest file)

Usage Example: Log files including the Wrapper's start time

It is also possible to create log files whose names include the start time of the Wrapper.

The following example will generate log files that include the Wrapper's start time. These files can be sorted by their names rather than modification times. The only benefit to using names rather than times is that the files will be preserved correctly even if they are modified.

Example Configuration:
wrapper.logfile=../logs/wrapper-%WRAPPER_TIME_YYYYMMDDHHIISS%-YYYYMMDD.log
wrapper.logfile.purge.pattern=../logs/wrapper-*-*.log
wrapper.logfile.purge.sort=NAMES_DEC
wrapper.logfile.rollmode=DATE
wrapper.logfile.maxfiles=10

Each of the properties in the example were used as follows:

  • wrapper.logfile :

    Following the log file setting, log files will be generated with file names including the Wrapper's start time.

  • wrapper.logfile.purge.pattern :

    The pattern to purge files is specified here. In this example, only the files whose names include 'wrapper-' and '.log' are going to be purged.

  • wrapper.logfile.purge.sort :

    The log files are sorted by their file names in descending order (NAMES_DEC).

  • wrapper.logfile.rollmode :

    Following the rolling mode (DATE), log files will be rolled automatically.

  • wrapper.logfile.maxfiles :

    The maximum number of rolled files is set to "10". A maximum of 10 files will be preserved besides the current file.

The following is a list of files which could exist, shown in their sorted order based on date (.purge.sort=NAMES_DEC). Note the fact that the PIDs are not sequential relative to time.

Example Log Files:
wrapper-20091020142321-20091025.log (Current file)
wrapper-20091020142321-20091024.log
wrapper-20091020142321-20091023.log
wrapper-20091020142321-20091022.log
wrapper-20091020142321-20091021.log
wrapper-20091020142321-20091020.log
wrapper-20091001123545-20091020.log
wrapper-20091001123545-20091019.log
wrapper-20091001123545-20091018.log
wrapper-20091001123545-20091017.log
wrapper-20091001123545-20091016.log (Oldest file)

Reference: logfile