Logging using SMTPAppender

Dear Community,

I’m trying to set up an SMTPAppender that would send me an email every time a message with WARN/ERROR serverity appears in the OpenHAB log.

I’ve added the following configuration to etc/org.ops4j.pax.logging.cfg and added the appender to the logger:

log4j.rootLogger = WARN, out, osgi:, email
[…]
log4j.appender.email=org.apache.log4j.net.SMTPAppender
log4j.appender.email.SMTPHost=192.168.0.4
log4j.appender.email.SMTPUsername=
**
log4j.appender.email.SMTPPassword=***
log4j.appender.email.From=***
log4j.appender.email.To=***
log4j.appender.email.Subject=OpenHAB error message
log4j.appender.email.BufferSize=1
log4j.appender.email.EvaluatorClass=TriggerLogEvent
log4j.appender.email.Threshold=WARN
log4j.appender.email.layout=org.apache.log4j.PatternLayout
log4j.appender.email.layout.ConversionPattern=%m

but I’m getting the following exception:

java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
[…]
Caused by: java.lang.ClassNotFoundException: javax.mail.internet.AddressException cannot be found by org.ops4j.pax.logging.pax-logging-service_1.8.5

I’m assuming that the required javax.mail classes need to be imported into karaf and made available for the logging service. What’s the easiest way to do that? I’ve tried a number of solutions found by googling but to be honest I’m not a karaf expert and my trial-and-error approach isn’t very effective :slight_smile:

Thanks a lot in advance,
Paweł