You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Boonlit Adipat <bo...@gmail.com> on 2008/06/24 15:37:08 UTC
A quick question about sending an email by using log4j in the MS exchange environment
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="myName@myCompany.com" />
<param name="To" value="myName@myCompany.com" />
<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
Re: A quick question about sending an email by using log4j in the MS exchange environment
Posted by Boonlit Adipat <bo...@gmail.com>.
Thank you very much for your response. I really appreciate it =)
On Wed, Jun 25, 2008 at 2:11 AM, Juha Laiho <Ju...@iki.fi> wrote:
> Boonlit Adipat wrote:
>
>> 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.
>>
>
> That is a question to ask from
> - system administrators providing you with the hardware & OS services
> for the server your application is running on
> - mail system administrators
>
> The correct response could even be "localhost", but don't use that
> without FIRST checking with the people who maintain your infrastructure.
> If you use it, and it "just works" now, it may be that it just happened
> to work, and was never supposed be a supported solution - and at some
> future moment you'll just find that what used to work doesn't work any
> more. By asking first, you should get as supported solution, and much
> better chances that you'll get notified if/when something changes
> (possibly also requiring changes to your configuration).
> --
> ..Juha
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
Re: A quick question about sending an email by using log4j in the
MS exchange environment
Posted by Juha Laiho <Ju...@iki.fi>.
Boonlit Adipat wrote:
> 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.
That is a question to ask from
- system administrators providing you with the hardware & OS services
for the server your application is running on
- mail system administrators
The correct response could even be "localhost", but don't use that
without FIRST checking with the people who maintain your infrastructure.
If you use it, and it "just works" now, it may be that it just happened
to work, and was never supposed be a supported solution - and at some
future moment you'll just find that what used to work doesn't work any
more. By asking first, you should get as supported solution, and much
better chances that you'll get notified if/when something changes
(possibly also requiring changes to your configuration).
--
..Juha
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org