Software AG Infrasructure 10.7 | Software AG Runtime Logging | Deleting sag-osgi Log Files
 
Deleting sag-osgi Log Files
You configure the Software AG Runtime sag-osgi log in the Software AG_directory \profiles\CTP\configuration\logging\log4j2.properties configuration file.
To automatically delete sag-osgi log files, specify values for the following parameters in the Platform.RollingLogFile appender in the log4j2.properties file:
*Set the appender.rolling.strategy.type parameter to DefaultRolloverStrategy.
*Set the appneder.rolling.strategy.max parameter to the maximum number of files that will be kept on the system at any given time. For example, if you specify a value of 2, the log keeps two files in addition to the current one. The default value is 10.
The following example shows how to configure the automatic deletion of sag-osgi log files, while keeping the last five log files in addition to the current one.
// other config
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 5
// other config
You can use forceful deletion simultaneously with automatic deletion of sag-osgi log files, when certain conditions are met. For example, use the following properties in the log4j2.properties file to delete the log files in the root folder in the logs directory if they have not been modified in the last hour and the file names in the folder have a .log.gz extension:
appender.rolling.strategy.action.type = Delete
appender.rolling.strategy.action.basepath = <location_of_logs>
appender.rolling.strategy.action.maxdepth = 1
appender.rolling.strategy.action.condition.type = IfLastModified
appender.rolling.strategy.action.condition.age = 1H
appender.rolling.strategy.action.PathConditions.type = IfFileName
appender.rolling.strategy.action.PathConditions.glob = *.log.gz
For more information about the appenders and configuration parameters in the log4j2.properties file, see the Apache Log4j 2 documentation.