Products | Versions |
---|---|
TIBCO Data Virtualization | 8.5.x and above |
Users can set the log rollover criteria for each year, month, day, hour, and minute depending on their requirements.
To achieve this, the user can use the TimeBasedTriggerringPolicy.
For example:
The user wants to maintain cs_server.logs for each day on an hourly and minute basis. To achieve this, replace the already existing file pattern of the log file for which you want to make these changes with the below pattern:
===========================
appender.MAIN.filePattern={TDV_INSTALL_DIR}/logs/$${date:yyyy-MM-dd-HH}/cs_server_%d{yyyy-MM-dd-HH-mm}_%i.log
appender.MAIN.policies.time.type = TimeBasedTriggeringPolicy
appender.MAIN.policies.time.interval = 1
appender.MAIN.policies.time.modulate = true
===========================
After adding the above lines, save the changes and restart the TDV Server.
- This will add a folder with a "yyyy-MM-dd-HH" timestamp i.e. for each hour and inside this folder, you will have a cs_server_yyyy-MM-dd-HH-mm_%i log file i.e., a cs_server.log file for every minute.
- If the user wants to have a log for each month in one folder and each day inside each month's folder, they will have to change the file pattern accordingly.
Example: filePattern=logs/$${date:yyyy-MM}/cs_server_%d{yyyy-MM-dd}_%i.log
- Similarly, for a yearly basis, use the following file pattern.
Example: filePattern=logs/$${date:yyyy}/$${date:yyyy-MM}/cs_server_%d{yyyy-MM-dd}_%i.log
For more information, refer to the online article and log4j-related documentation :
#1 https://stackoverflow.com/questions/19304165/time-based-triggering-policy-in-log4j2
#2. https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties