The following example defines a new appender for all modules, which sends logs to syslog.
- Edit:
instances/${instance.name}/log4j/all-modules.xml
- Add a Syslog appender definition (please refer to the SyslogAppender documentation) and reference it in a
AppenderRef
: log4j/all-modules.xml - Adapt the settings of the appender according to your needs (IP address, threshold, facility name).
<?xml version="1.0" encoding="UTF-8"?> <Configuration name="Custom Log4j 2 Configuration for All IAM Modules"> <Appenders> <Syslog name="SYSLOG" facility="LOCAL1" host="127.0.0.1" port="514" protocol="UDP" format="RFC5424" includeMDC="true" mdcId="mdc" newLine="true"> <ExceptionPattern>%ex{full}</ExceptionPattern> <ThresholdFilter level="INFO"/> </Syslog> </Appenders> <Loggers> <Root level="${sys:iam.log.level}"> <AppenderRef ref="SYSLOG"/> </Root> </Loggers> </Configuration>
The log4j configuration files are monitored for changes at a configurable interval (default 60s). No further action is required to activate the change.