My log4j.properties file:
log4j.appender.SMTP1=org.apache.log4j.net.SMTPAppender
log4j.appender.SMTP1.From=DoNotReply@mycompany.com
log4j.appender.SMTP1.Subject=Java Mail
log4j.appender.SMTP1.To=support@mycompany.com
log4j.appender.SMTP1.SMTPHost=authsmtp.mycompany.com
log4j.appender.SMTP1.SMTPProtocol=smtps
log4j.appender.SMTP1.smtp.starttls.enable=true
log4j.appender.SMTP1.LocationInfo=true
log4j.appender.SMTP1.Threshold=DEBUG
This works with the user name and password in the config file like this:
log4j.appender.SMTP1.SMTPUsername=USERNAME
log4j.appender.SMTP1.SMTPPassword=PASSWORD
but I have a password store that provides passwords and I can't put the plaintext password into a config file.
I can access the appender in my Java code ( I am setting the email subject using smtpAppender.setSubject() ) but I don't see any way to set the user name or password on the SMTPAppender object. Is there a trick that I'm missing ?