Logging: Unable to locate plugin type for SMTPAppender

Tags: #<Tag:0x00007efedc869188> #<Tag:0x00007efedc869098>

Dear Community,

I am using openHAB for a quite long time. Actually I am running version 2.4.0-1. Sometimes some binding struggles, so I need to restart openHAB or a connected gateway. To get informed, when there is some problem, I try to setup a SMTPAppender for any error.

But I am struggeling with the configuration.

When I add the following lines into the org.ops4j.pax.logging.cfg nothing will be logged anymore:

log4j2.appender.email.type = SMTPAppender 
log4j2.appender.email.name = EMAIL 
log4j2.appender.email.from = XXX
log4j2.appender.email.to = XXX
log4j2.appender.email.subject = openHAB-Meldung
log4j2.appender.email.smtpHost = XXX
log4j2.appender.email.smtpPort = XXX
log4j2.appender.email.smtpUsername = XXX
log4j2.appender.email.smtpPassword = XXX 
log4j2.appender.email.BufferSize = 1

I found the following error message in the journal:

2019-01-06 19:40:34,894 CM Configuration Updater (Update: pid=org.ops4j.pax.logging) ERROR Unable to locate plugin type for SMTPAppender
2019-01-06 19:40:34,987 CM Configuration Updater (Update: pid=org.ops4j.pax.logging) ERROR Unable to locate plugin for SMTPAppender
2019-01-06 19:40:34,996 CM Configuration Updater (Update: pid=org.ops4j.pax.logging) ERROR Unable to invoke factory method in class class
at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:52)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:248)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:131)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate(PaxLoggingServiceImpl.java:213)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:158)
at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServiceImpl.java:426)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker$1.run(ManagedServiceTracker.java:177)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updated(ManagedServiceTracker.java:173)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:152)
at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:85)
at org.apache.felix.cm.impl.ConfigurationManager$UpdateConfiguration.run(ConfigurationManager.java:1389)
at org.apache.felix.cm.impl.UpdateThread$1.run(UpdateThread.java:126)
at org.apache.felix.cm.impl.UpdateThread$1.run(UpdateThread.java:123)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.felix.cm.impl.UpdateThread.run0(UpdateThread.java:122)
at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:105)
at java.lang.Thread.run(Thread.java:748)

Is this an issue in openHAB or does anyone have a tip, what can I do, so that the smtpappender with log4j2 is usable?

Thanks in advance!

This is not directly related to openHAB, have you looked in there?
https://logging.apache.org/log4j/2.x/

Yes, of course. I read and tried a lot before I wrote this post.

In my opinion this is directly related to openHAB, because the class can not be found. I think it has to do with the way log4j2 is integrated. I do not know much about OSGI. But it looks like that the smtp-appender is not available and I do not know how change this, because this has to be done outside of de configuration file.

I think this has to do with OSGI, Karaf or OPS4J Pax Logging. But after trying the an afternoon and evening without success, I thought using an email appender should be straightforward and require no knowledge about more openHAB interna.

Does anyone else use this smtp appender and can give me a tip?

Does nobody else have this problem? I use openhab directly with openhabian.
So I thought that that this is a general problem.

Hey @FlatStep, did you get it working? I want to configure OpenHAB with a SentryAppender and i get the same errors