Configuring log rotation
The log rotation parameters define the log level for messages, maximum log file size in megabytes (MB), and the maximum backup count of log files.
About this task
The packaged log rotation settings are set to use the propagated values from the host factory service.
A requestor instance uses these propagated values from the host factory parameters when the requestor instance does not specify the log rotation settings in its configuration files. If a requestor instance has its own local log rotation settings, then the requestor instance overrides the propagated values from the host factory.
A
provider instance uses its own parameters set in the log4j2.xml file available
in the provider's configuration folder. For details on log4j2.xml
settings, see
https://logging.apache.org/log4j/2.x/manual/configuration.html.
Procedure
Configuring log rotation for host factory
Procedure
Configuring log rotation for requestor instances
Procedure
Configuring log rotation for provider instances
Procedure
RollingFile
appenders section. For example: <Appenders>
<RollingFile name="FILE_APPEND" fileName="${baseDir1}awsinst-provider.${hostName}.log" filePattern="${baseDir1}awsinst-provider.${hostName}-%d{MM-dd-yyyy}-%i.log.gz" append="true">
<PatternLayout>
<Pattern>${logPattern}</Pattern>
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="10MB" />
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
</Appenders>
By default, host factory
provider instances use the RollingFile
appender. From the example file, note that
log rotation is triggered when the file size reaches 10MB, and is set to keep a maximum of five log
files.
Customize this configuration or add more policies for different trigger methods. For details on
RollingFile
appender, refer to the Log4j2 appender documentation.