Dear all I am sorry that I bother you during your busy schedule. Currently, I am trying to use log4j to send an email notification to an administrator if errors occur in my system.
What should be the value for the "SMTPHost" in the log4j.xml if my company uses *Microsoft Exchange Server* as the email server. Currently, I just know that the hostname of the MS Exchange server is prdcgwsemlmb01.prod-am.myCompany.com<http://prdcgwsemlmb01.prod-am.mycompany.com/> However, the code below never works. I never got any email that report errors. The following is the setup in my log4j.xml. *<!-- EMail to an administrator -->* <appender name="ErrorNotification" class="org.apache.log4j.net .SMTPAppender"> <param name="SMTPHost" value="prdcgwsemlmb01.prod-am.myCompany.com<http://prdcgwsemlmb01.prod-am.mycompany.com/>" /> <param name="From" value="[EMAIL PROTECTED]" /> <param name="To" value="[EMAIL PROTECTED]" /> <param name="Subject" value="Client Notification Service (CNS) Batch error" /> <param name="BufferSize" value="1" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p %c{1}:%L - %m%n" /> </layout> </appender> <category name="NotificationEmail" additivity="false"> <priority value="ERROR" /> <appender-ref ref="ErrorNotification" /> </category> The following is how I created a log4j instance and send the log statements. private static Logger loggerEmail = Logger.getLogger("NotificationEmail"); loggerEmail.error("errors occurred"); If you could give me any suggestions, I would really appreciate it! Thank you very much. Best Regards, Pay
