code:commercial:hse-logger_extensions:log-rotate-handler
Table of Contents
LogRotate Handler
This extension for the default FileHandler can rotate log files like the Linux Logrotate command.
Installation
We provide a VI package (*.vip) to be installed with the JKI VI Package Manager.
Configuration
The Create LogRotate method takes a cluster LogRotate Configuration for all specific options.
Cluster LogRotate Configuration:
-
Rotations: Max number of rotations for the log file. With
nrotations, there will benadditional files to the log file. If Rotations is0, no file with the content of the previous period will be created. -
Max Size (Byte): If the log file size exceeds “Max Size”, the log file will be rotated. If “Max Size” is
0, the log file will not be rotated by file size. -
Period: The period in which interval the rotation will be executed. Possible intervals are:
-
None: No rotation by period. -
Instant (for testing): The file will be rotated instantly with every log event. This case is intended for testing only. -
hourly: The log file will be rotated on every full hour. -
daily: The log file will be rotated on every new day. -
weekly: The log file will be rotated on every new week. -
monthly: The log file will be rotated on every new month.
Compression CMD: If provided, use this command to compress the rotated log files with an external program (e.g. 7zip, gzip). If the command contains white spaces, it must be enclosed in quotes. The variable$INPUTcontains the file path of the rotated log file and the variable$OUTPUTthe file path of the compressed output file. Do _not_ enclose these variables in quotes, this is done automatically.$INPUTis mandatory,$OUTPUTnot, it depends on the program whether you need it. See examples below.Compress Extension: Filename extension for the compressed log files, e.g. “zip”.For versions ⇐ 1.0.2, you have to use the file extension.logfor the log file. Otherwise, it will throw an error after the second log.Initialization
The initialization is the same as for other Log-Handler. Use the method
Create LogRotateFileHandler.vito instantiate a new LogRotate-Handler and configure it. Then wire the object together with other Log-Handlers, if applicable, as array to theInit Logginmethod.Compression CMD examples
7-Zip on Windows with zip file format:
“C:\Program Files\7-Zip\7z.exe” a -tzip $OUTPUT $INPUTGZip on Linux:
gzip “$INPUT” -
code/commercial/hse-logger_extensions/log-rotate-handler.txt · Last modified: 2026/06/15 16:31 by joerg.hampel
