Skip to content

UmenR/log4j-async-email-appender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

log4j-async-email-appender

A log4j appender to send emails asynchronously.

This email appender creates a threadpool of 5 threads using the java EventExecutorService to send emails asynchronously.

Instructions

  • Checkout repo
  • Build project using mvn clean install
  • Copy jar file in target folder to <WSO2_PRODUCT>/repository/components/lib directory
  • Follow instructions below to add appender to log4j.properties file
log4j.appender.ASYNC_EMAIL_SENDER=sample.log4j.appender.async.mail.sender.EmailAppender
log4j.appender.ASYNC_EMAIL_SENDER.layout=org.wso2.carbon.utils.logging.TenantAwarePatternLayout
log4j.appender.ASYNC_EMAIL_SENDER.layout.ConversionPattern=TID: [%T] [%S] [%d] %P%5p {%c} - %x %m {%c}%n
log4j.appender.ASYNC_EMAIL_SENDER.layout.TenantPattern=%U%@%D[%T]
log4j.appender.ASYNC_EMAIL_SENDER.smtpHost=smtp.gmail.com
log4j.appender.ASYNC_EMAIL_SENDER.smtpUsername=<sender>
log4j.appender.ASYNC_EMAIL_SENDER.smtpPassword=<password>
log4j.appender.ASYNC_EMAIL_SENDER.smtpPort=587
log4j.appender.ASYNC_EMAIL_SENDER.subject=<subject>
log4j.appender.ASYNC_EMAIL_SENDER.receiver=<receiver>
log4j.appender.ASYNC_EMAIL_SENDER.filter.f0=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.ASYNC_EMAIL_SENDER.filter.f0.LevelMin=ERROR
log4j.appender.ASYNC_EMAIL_SENDER.filter.f0.LevelMax=FATAL
log4j.appender.ASYNC_EMAIL_SENDER.filter.f1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.ASYNC_EMAIL_SENDER.filter.f1.StringToMatch=Error occurred while obtaining LDAP connection
log4j.appender.ASYNC_EMAIL_SENDER.filter.f1.AcceptOnMatch=TRUE
log4j.appender.ASYNC_EMAIL_SENDER.filter.f2=org.apache.log4j.varia.DenyAllFilter

By default the email sender has "starttls.enabled" property set to true.

NOTE Please Remove the EmailTester.java file when building for production environments.

About

A log4j appender to send emails asynchronously

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages