Reputation: 37
I am trying to configure my log4j properties file in order to send emails when are error occurs. I have it working for one person, and am receiving the emails whenever an error occurs. However, I want to have the emails be sent to multiple people on my team when something happens. Is there a way to configure this? Here is my log file:
log4j.rootLogger=warn, sendMail
log4j.logger.org.apache=ERROR
log4j.appender.sendMail=org.apache.log4j.net.SMTPAppender
log4j.appender.sendMail.Threshold=WARN
[email protected]
[email protected]
log4j.appender.sendMail.SMTPHost=smtp.asdf.asdf.com
log4j.appender.sendMail.Subject=Error Log Message
log4j.appender.sendMail.layout=org.apache.log4j.PatternLayout
log4j.appender.sendMail.layout.ConversionPattern=%p %t %c - %m%n
log4j.appender.sendMail.BufferSize=1
I have tried adding a comma after the 'To' command and adding another email address, but that person does not receive it. Any ideas on how I can configure this file to send the errors to multiple people?
Upvotes: 2
Views: 3565
Reputation: 1
Maybe you can skip the problem altogether by using a mail alias or a mailing list instead of a list of mail addresses here.
This seams to have the advantage that is is probably easier to maintain than modifying your property-file each time.
Upvotes: -1
Reputation: 2290
This is considered the correct way to use multiple appends, in log4j1.2.x:
[email protected],[email protected],[email protected]
Source 1: Old archives of Log4j
Source 2: Log4j wiki
Upvotes: 5