I\'m trying to use log4j to send emailable reports that contain the logging statements from a background process. I want one email sent for each process run, not one email
Log4j 2.x onwards, the following configuration for log4j.xml can be used. It's pretty straightforward and can be used to send emails.
You need to edit it and enter your smtp host, username, password, port and subject.
Mail1
SUBJECT
TO_EMAIL
FROM_EMAIL
smtp.gmail.com
487
false
username
password
smtps
Reference: Log4j SMTP Appender