You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Adam Jack <ad...@AdventureCentral.com> on 2005/09/21 04:30:43 UTC

SmtpAppender buffer flush (to mail) on shutdown.

Howdy folks,

 

I hope this isn't an FAQ, but I couldn't find the answer in mailing list
archives or in the documentation. 

 

I have an SmtpAppender pretty much configured as in the example:

 

 
http://logging.apache.org/log4net/release/config-examples.html#smtpappen
der

 

It is running inside my webapp (configured in the web.config) and works
wonderfully, e-mailing me when I get a page crash/error event. 

 

The only bummer is sometimes it e-mails me when nothing is wrong, but
the webapp has timed out (and is being torn down.) The buffer of
non-error log message is sent to me. I've attached the config below, and
looking at it I see lossy set to false - which is a worry, I'll set it
true again - but I'm pretty certain I only tinkered with that setting
when this started happening. Of course, I was preparing this e-mail as I
found that setting. 

 

Time will tell if this fixes the problem, but I'd really appreciate
insights. Is this a designed in feature, or an unintentional side
effect? If intentional can I disable it with some (say) disable
statement when I capture the shutdown event?

 

Thanks for insights, and thanks for this product on this platform.

 

Regards

 

Adam

--

Adventure Central

http://www.AdventureCentral.com

"Great Experiences Deserve Great Technology"

303 292 5522 x111

Denver, CO USA

 

 

                        

                        <appender name="SmtpAppender"
type="log4net.Appender.SmtpAppender,log4net">

                                    <to
value="Adam.Jack@AdventureCentral.com" />

                                    <from
value="dev@AdventureCentral.com" />

                                    <subject value="AdventureWeb
Logging." />

                                    <bufferSize value="512" />

                                    <lossy value="false" />

                                    <evaluator
type="log4net.Core.LevelEvaluator,log4net">

                                                <threshold value="ERROR"
/>

                                    </evaluator>

                                    <layout
type="log4net.Layout.PatternLayout,log4net">

                                                <conversionPattern
value="%property{log4net:HostName} :: %level :: %message %newlineLogger:
%logger%newlineThread: %thread%newlineDate: %date%newlineNDC:
%property{NDC}%newline%newline" />

                                    </layout>

                        </appender>