When you use lossy=false in your configuration you get all the INFO messages 
because the threshold element in the evaluator is ignored. The evaluator is 
only active when lossy=true. When you combine this with a buffersize=1 the 
buffer is flushed after every message.

When you use lossy=true in your configuration messages are replaced when the 
buffer is full. You're only getting the most recent ERROR error because the 
buffer is set to 1...the last message is placed in the buffer then the buffer 
is flushed.

The lossy and evaluators settings make more sense when buffersize is greater 
than 1.

How are you wanting to receive your messages?

----- Original Message ----
From: "Johnson, Cedrick" <[EMAIL PROTECTED]>
To: [email protected]
Sent: Wednesday, December 12, 2007 8:37:08 PM
Subject: Lossy Value in SMTP Appender - Possible Bug?





 
 

<!--

 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times 
New Roman";}
a:link, span.MsoHyperlink
        {color:blue;text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
span.EmailStyle17
        {font-family:Arial;color:windowtext;}
 _filtered {margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {}
-->






Hello-
 

  
 

My apologies, I’ve been trying to figure this out for
the past few hours. We have an application that has the following log4net 
config:
 

  <root>
 

    <level value="INFO" />
 

    <appender-ref ref="RollingLogFileAppender"
/>
 

    <appender-ref
ref="ConsoleAppender" />
 

    <appender-ref
ref="SmtpAppender" />
 

  </root>
 

  
 

Pretty simple
 

  
 

In the SmtpAppender:
 

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

    <to value="me" />
 

    <from value="someprocess"
/>
 

    <subject value="An error occured
in some process" />
 

    <smtpHost value="ourmailserver"
/>
 

    <bufferSize value="1" />
 

    <lossy value="true" />
 

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

      <threshold
value="ERROR"/>
 

    </evaluator>
 

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

      <conversionPattern
value="%date %property{MachineName} %property{UserName} [%thread] %-5level
%logger - %message %newline" />
 

    </layout>
 

  
 

  
 

Generic. Yes, we have BufferSize set to 1, however,
Development sent me a file with lossy=true. I understand how the lossy value
works, but I am a little fuzzy on this particular situation, which I will
describe below:
 

  
 

With Lossy set to ‘false’.. I got 18,000 emails
(every INFO level message was in its own email) despite having the threshold
value set to ‘ERROR’.
 

  
 

If I set lossy to true, I get the true ‘ERROR’
and above emails (and it’s not 18,000)
 

  
 

Perhaps I’m just utterly confused, but I don’t
exactly see the correlation between lossy, buffersize and LevelEvaluator. Is
this a potential bug given the situation described earlier?
 

  
 

Regards,
 

CJ
 







Reply via email to