Questions asked by karstenkhttps://answers.axonivy.com/questions/asked-by/1150/karstenk/?type=rssQuestions asked by <a href="/users/1150/karstenk" >karstenk</a>enThu, 03 Jan 2019 05:05:38 -0500Log Mail with Log4J SMTP Appender doesn't workhttps://answers.axonivy.com/questions/3601/log-mail-with-log4j-smtp-appender-doesn-t-work<p>Hello, i want Axon Ivy to send an Email when there is an error so i added this code to "log4jconfig.xml":</p> <pre><code>&lt; appender name="EmailAppender" class="org.apache.log4j.net.SMTPAppender"&gt; &lt; param name="BufferSize" value="512" / &gt; &lt; param name="SMTPHost" value="smtp.gmail.com" / &gt; &lt; param name="SMTPProtocol" value="smtps" / &gt; &lt; param name="SMTPPort" value="465" / &gt; &lt; param name="SMTPUsername" value=" *** " / &gt; &lt; param name="SMTPPassword" value=" *** " / &gt; &lt; param name="From" value=" *** " / &gt; &lt; param name="To" value=" *** " / &gt; &lt; param name="Subject" value="Testing Log4j Mail Notification" / &gt; &lt; layout class="org.apache.log4j.PatternLayout"&gt; &lt; param name="ConversionPattern" value="%-7p %d [%t] %c %x - %m%n" / &gt; &lt; /layout &gt; &lt; /appender &gt; &lt; root &gt; &lt; level value ="WARN" / &gt; &lt; appender-ref ref="FileLog"/ &gt; &lt; appender-ref ref="EmailAppender"/ &gt; &lt; appender-ref ref="ConsoleAppender"/ &gt; &lt; /root &gt; </code></pre> <p>The FileLog works but i dont receive the email. When i change the order to this:</p> <pre><code>&lt; appender-ref ref="EmailAppender"/ &gt; &lt; appender-ref ref="FileLog"/ &gt; </code></pre> <p>then the FileLog and the MailAppender doesn't work. <br> When i use the same code in an Eclipse Java Project it works and i get the email. </p> <p>What should i do?</p> <p>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.</p> <p>Edit2: With Log4j debug=true i get this Error in my logfile: <br> 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) <br> ...</p>karstenkThu, 03 Jan 2019 05:05:38 -0500https://answers.axonivy.com/questions/3601/log-mail-with-log4j-smtp-appender-doesn-t-workxmlloggingemaillog4j