Perspectium Meshlets produces logs to help you troubleshoot and debug issues with the meshlet. You can modify how logging files are archived by setting the rolling policy to control how many log files are kept to account for disk space limitations and not have log files accumulate or get too large/old. To learn more about rolling policies, check here.
NOTE: Any log files older than 14 days will be rotated (Version 5.0.3.11).
Prerequisites
First, contact Perspectium Support to get the logback-spring.xml logging configuration file.
Procedure
To configure how the meshlet log files are archived, follow these steps:
Edit the logback file
Place the logback-spring.xml file Perspectium Support provided for you in the config folder where the meshlet is installed. If there is no config folder, create the folder at the same location as the meshlet's executable jar file.
Open the logback-spring.xml file in the text editor of your choice. Then, edit the rolling policy under the <rollingPolicy> directive. The options below will allow you to control how often log files are archived (i.e. a version of the log file with its current data is moved to an archived file so the current default logging file is reset to start fresh and not get too large).
Configuration | Description |
---|---|
<fileNamePattern> | To control the name of the archived log files and how often a new archived log file is created by date and time. The %d{yyyy-MM-dd} value specifies the date and time period when a new archived log file will be created. In this example %d{yyyy-MM-dd} means a new log file is created daily. %d{yyyy-MM-dd_HH} would indicate a new file is created hourly as the last value specified indicates how often an archived log file is created. The available options are yyyy, MM, dd, HH, mm, ss (year, month, day, hour, minute, second). |
<maxFileSize> | To change the maximum size of the log file must reach when an archived log file is created. The property here is used in conjunction with <fileNamePattern> such that a new log file will either be created based on the date and time or when a maximum size is reached. For example, a value of 10MB will create a new log file and archive the current log file when it reaches 10MB. |
<maxHistory> | To control how many archived log files are kept before old ones are deleted. This value is based relative to the date and time rotation you set in <fileNamePattern>. For example, if you specify log files to rotate daily and enter a value of 10, then the last 10 days of archived log files will be kept. |
<totalSizeCap> | To controls the total size of all archived log files. Oldest log files are deleted when the total size cap is exceeded. This property requires <maxHistory> to be set as well. Moreover, <maxHistory> property is always applied first and <totalSizeCap> is applied second. |
Rolling Policy Example
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- rollover to archive log file daily and when the file reaches 10 megabytes --> <fileNamePattern>${LOGS}/archived/perspectium-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <maxFileSize>10MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> <!-- keep 10 days of log files with a maximum of 100MB total of archived log files--> <maxHistory>10</maxHistory> <totalSizeCap>100MB</totalSizeCap> </rollingPolicy>
Run the meshlet
Add the -Dlogging.config="./config/logback-spring.xml" argument to the command to run your meshlet.
Linux:
java -Dspring.profiles.active=dev -Dlogging.config="./config/logback-spring.xml" -jar <perspectium-meshlet>.jar
Windows:
java -Dspring.profiles.active=dev -Dlogging.config=".\config\logback-spring.xml" -jar <perspectium-meshlet>.jar
Where <perspectium-meshlet>.jar is the name of Perspectium Meshlet Application to run.