Hi,
I would like to setup a Karaf based system to send mails for log
messages of priority WARN and ERROR.
I read some of the "Apache Karaf Decanter 2.x" documentation.
$ tar xzf apache-karaf-4.2.6.tar.gz
$ cd apache-karaf-4.2.6/
$ bin/karaf
karaf@root()> feature:repo-add
mvn:org.apache.karaf.decanter/apache-karaf-decanter/2.0.0/xml/features
karaf@root()> feature:install decanter-collector-log
karaf@root()> feature:install decanter-alerting-email
There are now three configuration files:
* org.apache.karaf.decanter.alerting.checker.cfg
* org.apache.karaf.decanter.alerting.email.cfg
* org.apache.karaf.decanter.collector.log.cfg
Edit "org.apache.karaf.decanter.alerting.checker.cfg" and add that lines:
===
loggerLevel.error=match:ERROR
loggerLevel.warn=match:WARN
===
Add the mail setup to "org.apache.karaf.decanter.alerting.email.cfg".
Keep the standard "org.apache.karaf.decanter.collector.log.cfg".
Let's trigger an ERROR log by trigger a feature installation of an non
existing one:
karaf@root()> feature:install unknown-feature-name
The error contains that message:
===
13:40:55.830 ERROR [Karaf local console user karaf] Exception caught
while executing command
java.lang.IllegalArgumentException: No matching features for
unknown-feature-name/0
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.computeFeaturesToAdd(FeaturesServiceImpl.java:835)
~[?:?]
at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:798)
~[?:?]
at
org.apache.karaf.features.command.InstallFeatureCommand.doExecute(InstallFeatureCommand.java:78)
~[?:?]
at
org.apache.karaf.features.command.FeaturesCommandSupport.execute(FeaturesCommandSupport.java:40)
~[?:?]
at
org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
~[?:?]
at
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
~[?:?]
at
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
~[?:?]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599)
~[?:?]
at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526)
~[?:?]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
~[?:?]
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
~[?:?]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
===
I would expect to receive a mail message now.
No mail has been received.
If I try to use the TRACE level for the decanter package space to
"see" what's going on
karaf@root()> log:set TRACE org.apache.karaf.decanter
I get the additional log message:
===
2019-07-08 13:48:55,021 Karaf local console user karaf ERROR Recursive
call to appender PaxOsgi
===
So, I assume I need to use a debugger to get further information what
is going on / wrong.
Any other suggestions?