Log Mail with Log4J SMTP Appender doesn't work
Hello,
i want Axon Ivy to send an Email when there is an error so i added this code to "log4jconfig.xml":
< appender name="EmailAppender" class="org.apache.log4j.net.SMTPAppender">
< param name="BufferSize" value="512" / >
< param name="SMTPHost" value="smtp.gmail.com" / >
< param name="SMTPProtocol" value="smtps" / >
< param name="SMTPPort" value="465" / >
< param name="SMTPUsername" value=" *** " / >
< param name="SMTPPassword" value=" *** " / >
< param name="From" value=" *** " / >
< param name="To" value=" *** " / >
< param name="Subject" value="Testing Log4j Mail Notification" / >
< layout class="org.apache.log4j.PatternLayout">
< param name="ConversionPattern" value="%-7p %d [%t] %c %x - %m%n" / >
< /layout >
< /appender >
< root >
< level value ="WARN" / >
< appender-ref ref="FileLog"/ >
< appender-ref ref="EmailAppender"/ >
< appender-ref ref="ConsoleAppender"/ >
< /root >
The FileLog works but i dont receive the email.
When i change the order to this:
< appender-ref ref="EmailAppender"/ >
< appender-ref ref="FileLog"/ >
then the FileLog and the MailAppender doesn't work.
When i use the same code in an Eclipse Java Project it works and i get the email.
What should i do?
Edit: Do i have to add mail.jar and activation.jar to my build path in Axon Ivy? In Eclipse i added them to lib and it worked but i don't know how to integrate them to Axon Ivy.
Edit2: With Log4j debug=true i get this Error in my logfile:
2019-01-22 16:21:32.230 ERROR [ch.ivyteam.log.LoggerFactory] [main] []
Log4j: Could not configure
java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:247)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
...