Enabling Email Logging from Log4j2
The following sample configuration will enable email logging of ERROR level log messages in Oracle Utilities Operational Device Management. When an error is encountered in startup and during operations of the product any ERROR message displayed on the console log file will be emailed to an Administrator's email account or email group.
The following changes are required to enable this.
1. Open the log4j2.properties in the relevant $SPLEBASE/etc/conf subdirectory:
• Web Application Server – log4j2.properties – Product Logging Configuration
• Business Application Server - log4j2.properties – Product Logging Configuration
2. Add the following lines to the file:
### E1 is an EmailAppender
log4j2.appender.E1 = org.apache.log4j2.net.SMTPAppender
log4j2.appender.E1.Threshold = ERROR
log4j2.appender.E1.layout = org.apache.log4j2.PatternLayout log4j2.appender.E1.layout.ConversionPattern = %d{ISO8601} [%t] %-5p %c %x - %m%n
log4j2.appender.E1.From = <from>
log4j2.appender.E1.SMTPHost = <SMTPHost>
log4j2.appender.E1.Subject = <subject>
log4j2.appender.E1.To = <to>
###
### The following settings are optional
###
log4j2.appender.E1.SMTPUsername = <SMTPUsername>
log4j2.appender.E1.SMTPPassword = <SMTPPassword>
log4j2.appender.E1.CC = <cc>
log4j2.appender.E1.BCC = <bcc>
3. Modify the following lines in the log4j.properties file:
## System-wide settings
# set log levels - for more verbose logging change 'info' to 'debug' ###
log4j2.rootCategory=info, A1, F1, E1
4. Execute the initialSetup – Maintain Configuration Settings utility, with the –w option, to reflect the changes in the WAR/EAR file.
To deploy the application refer to the Web Application Server Deployment Process or Web Application Server Deployment Process.