Logging stuff in endless loops is generally a good way to blow things up. ;-) I remember back in my university days a friend of mine did some logging on /tmp on 150 or so Sun workstations. It went into an endless loop and all of the workstations became inaccessible (/tmp and virtual memory were connected, don't ask why, so login failed with an out of memory error :-))

What you can do in case your mail server doesn't throttle and protect you against DOS-attacks, is use log4j's triggering event evaluator and put throttling into that.

See:

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/net/SMTPAppender.html

and:

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/spi/TriggeringEventEvaluator.html)

Thus by limiting your buffer size of the SMTPAppender and make sure you can only have N triggering events per hour, you can easily avoid this problem.

Good point though, Martijn. :-)

Regards,
Sebastiaan



Martijn Dashorst wrote:
It is a really good way to blow up your exchange server... We had a
bug somewhere that generated exceptions in an endless loop. It took
exchange over a whole day to empty the queue.

Martijn

On 3/10/08, Edvin Syse <[EMAIL PROTECTED]> wrote:
Wow, that's a very nice solution. Thanks :))

 -- Edvin

 Sebastiaan van Erk skrev:

I would say that the standard practice is probably to use your logging
 > subsystem to email you the exception.
 >
 > For example, if you are using log4j to log, you could add something like
 > this to your log4j.xml file:
 >
 >     <appender name="ERRORMAILER"
 >         class="org.apache.log4j.net.SMTPAppender">
 >         <param name="from" value="[EMAIL PROTECTED]" />
 >         <param name="to" value="[EMAIL PROTECTED]" />
 >         <param name="subject" value="[mydomain] ERROR" />
 >         <param name="SMTPHost" value="localhost" />
 >         <param name="threshold" value="ERROR" />
 >         <layout class="org.apache.log4j.PatternLayout">
 >             <param name="ConversionPattern" value="%d %-5p - [%C:%L]
 > %m%n" />
 >         </layout>
 >     </appender>
 >
 > Regards,
 > Sebastiaan
 >
 >
 > Edvin Syse wrote:
 >> Hi. In my application I do:
 >>
 >>         getApplicationSettings().setInternalErrorPage(ErrorPage.class);
 >> 
getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
 >>
 >>
 >> to display a custom page for error messages. I would also like to
 >> email myself the exception - is it possible that I can get a hold of
 >> the throwable from the ErrorPage.class, or do I have to explicitly
 >> catch and rethrow a RestartResponseException to obtain the exception?
 >>
 >> -- Edvin
 >>
 >>
 >>
 >> ---------------------------------------------------------------------
 >> To unsubscribe, e-mail: [EMAIL PROTECTED]
 >> For additional commands, e-mail: [EMAIL PROTECTED]
 >>

 ---------------------------------------------------------------------
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to