I don't know why it would work with 1 but not with 512. At least we
know the SmtpAppender is working correctly. Is there a message body
size limit imposed by your server? Why not run more tests to get a
better idea of what the bufferSize fails on:

 1: works
 10: ???
 50: ???
 200: ???
 350: ???
 512: doesn't work

If the bufferSize fails to delivery 350 messages I would output 350
message to a text file then read those messages in and try manually
sending the mail:

 using System.Web.Mail;
 MailMessage mailMessage = new MailMessage();
 mailMessage.To = "[EMAIL PROTECTED]";
 mailMessage.From = "[EMAIL PROTECTED]";
 mailMessage.Subject = "Subject";
 using (StreamReader sr = new StreamReader("350_log_messages.txt")) 
 {
  mailMessage.Body = sr.ReadToEnd();
 }
 SmtpServer.Send(mailMessage);

If that works and 512_log_messages.txt works I'm afraid I've run out of
ideas :(

Another non-related comment...It would be interesting if someone wrote
a SmtpAppender that would send the logging events as an attachment:

 <appender name="AttachmentSmtpAppender" type="...">
  <to value="..." />
  <from value="..." />
  <subject value="..." />
  <body value="See attached file(s) for logs" />
  <smtpHost value="..." />
  <bufferSize value="512" />
  <layout type="log4net.Layout.SimpleLayout" />
  <attachedFile value="DEBUG.txt">
   <filter type="log4net.Filter.LevelMatchFilter">
    <levelToMatch value="DEBUG" />
   </filter>
  </attachedFile>
  <attachedFile value="INFO.txt">
   <filter type="log4net.Filter.LevelMatchFilter">
    <levelToMatch value="INFO" />
   </filter>
  </attachedFile>
 </appender>

That would send a single message with a user supplied body that would
contain two attachments: DEBUG.txt containing only DEBUG messages and
INFO.txt containing only INFO messages.

--- Usman Uppal <[EMAIL PROTECTED]> wrote:

> Ron, Yes setting buffer to 1 works on the third party server. I am
> getting one email per line of information logging.
> 
> Why buffer size of 512 works from my pc and not the 3rd party server?
> What should be appropriate buffer size?
> usman
> 
> -----Original Message-----
> From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 28, 2005 12:57 PM
> To: Log4NET User
> Subject: RE: LOG4NET - SMTP Appender Not Working
> 
> Your had posted this earlier:
> 
>  <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
>   <to value="[EMAIL PROTECTED]" />
>   <from value="[EMAIL PROTECTED]" />
>   <subject value="ERROR - test Account Process Logging Message" />
>   <smtpHost value="192.168.1.3" />
>   <bufferSize value="512" />
>   <lossy value="false" />
>   <filter type="log4net.Filter.LevelRangeFilter">
>    <param name="LevelMin" value="INFO"/>
>    <param name="LevelMax" value="ERROR"/>
>   </filter>
>   <layout type="log4net.Layout.PatternLayout">
>    <conversionPattern value="[%date]    %message" />
>   </layout>
>  </appender>
> 
> You are aware that no emails will be sent until 512 messages have
> been
> queued up?
> 
> Are you able to send mail using these more general settings?
> 
>  <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
>   <to value="[EMAIL PROTECTED]" />
>   <from value="[EMAIL PROTECTED]" />
>   <subject value="ERROR - test Account Process Logging Message" />
>   <smtpHost value="192.168.1.3" />
>   <bufferSize value="1" />
>   <layout type="log4net.Layout.SimpleLayout" />
>  </appender>
> 
> --- Usman Uppal <[EMAIL PROTECTED]> wrote:
> 
> > Ron, I can send email using your sample code on hosted server. 
> > 
> >  
> > 
> >       using System.Web.Mail;
> > 
> >  MailMessage mailMessage = new MailMessage();
> > 
> >  mailMessage.To = "[EMAIL PROTECTED]";
> > 
> >  mailMessage.From = "[EMAIL PROTECTED]";
> > 
> >  mailMessage.Subject = "Subject";
> > 
> >  mailMessage.Body = "Hello World";
> > 
> >  SmtpServer.Send(mailMessage);
> > 
> >  
> > 
> >  
> > 
> > Any other suggestions?
> > 
> >  
> > 
> > Thanks,
> > 
> >  
> > 
> > Usman
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> > -----Original Message-----
> > From: Ron Grabowski [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, September 28, 2005 11:33 AM
> > To: Log4NET User
> > Subject: RE: LOG4NET - SMTP Appender Not Working
> > 
> >  
> > 
> > I don't think you mentioned the part about the application being
> > hosted
> > 
> > on a 3rd party server. Have you verified that you can send mail on
> > that
> > 
> > server?
> > 
> >  
> > 
> >  using System.Web.Mail;
> > 
> >  MailMessage mailMessage = new MailMessage();
> > 
> >  mailMessage.To = "[EMAIL PROTECTED]";
> > 
> >  mailMessage.From = "[EMAIL PROTECTED]";
> > 
> >  mailMessage.Subject = "Subject";
> > 
> >  mailMessage.Body = "Hello World";
> > 
> >  SmtpServer.Send(mailMessage);
> > 
> >  
> > 
> > If you can't send mail, I would extend SmtpAppender and override
> the
> > 
> > SendBuffer method to use something like OpenSMTP:
> > 
> >  
> > 
> >  http://sourceforge.net/projects/opensmtp-net/
> > 
> >  
> > 
> > The new implementation would be very similiar to the base one:
> > 
> >  
> > 
> > http://tinyurl.com/a55ec
> > 
> >
>
http://cvs.apache.org/viewcvs.cgi/logging-log4net/src/Appender/SmtpAppen
> > der.cs?rev=1.9&view=markup
> > 
> >  
> > 
> > On a slightly unreleated note, here's a screen shot of log4net's
> > 
> > SmtpAppender viewed from NLogViewer using nDumbster as a mock
> > 
> > SmtpServer (thanks to Jarek for cleaning up my code):
> > 
> >  
> > 
> >  http://www.ronosaurus.com/log4net/nlogviewer_ndumbster_log4net.png
> > 
> >  
> > 
> > That should be helpful in determining what a good bufferSize
> property
> > 
> > of the SmtpAppender is so it doesn't queue up messages for days
> then
> > 
> > suddenly attempt to send a giant 200mb email.
> > 
> >  
> > 
> > --- Usman Uppal <[EMAIL PROTECTED]> wrote:
> > 
> >  
> > 
> > > Ron, SMTP Appender works on my machine using our internal SMTP
> host
> > 
> > > but
> > 
> > > when I deploy my code on a hosted server (outside of our
> > environment)
> > 
> > > that is using different SMTP host, it does not work.
> > 
> > > 
> > 
> > > Do we need to have Exchange CDO installed on the hosted server?
> Any
> > 
> > > other requirements that I should check for?
> > 
> > > 
> > 
> > > Thanks for your help.
> > 
> > > 
> > 
> > > Usman
> 
> 

Reply via email to