Sorry, ignore that last email, its actually working as I want. 
 
Does anybody know if its possible to configure a RichTextBoxAppender (log 
output goes to a rich text box, its a contribution by another engineer not the 
original author(s) of log4net, (I think). If I can get buffering in place for 
the RichTextBox appender, I will have the same output but without the overhead 
(i.e. DEBUG info at no price.. so to speak).
 
thanks
 
Graham

________________________________

From: WALSH, Graham (CALYON) 
Sent: jeudi 26 février 2009 09:09
To: Log4NET User
Subject: RE: DEBUG vs INFO


sorry, but I'm having trouble with one part of this config, I always do. I have 
taken the BufferingForwardingAppender and put it in place, its works a treat. 
 
I've also got another appender which is used to display log output in the GUI 
window. Now I want BufferingForwardingAppender  (which logs to file) to log at 
debug level but my other appender (RichTextFormAppender) to log at just INFO 
level. I can't get this working though.
 
My (messy) log4net stuff looks like this, could anybody let me know how I can 
get the two levels of logging in place? Once thats done, I'm water tight in 
terms of delivery
 
thanks much
 
Graham
 
 
<log4net>

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

<bufferSize value="255" />

<lossy value="false" />

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

<threshold value="DEBUG"/>

</evaluator>

<appender-ref ref="RollingFile" />

</appender>

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">

<file value="logs/NewLogFile.log" />

<appendToFile value="true" />

<maximumFileSize value="100MB" />

<maxSizeRollBackups value="-1" />

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

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

</layout>

</appender>

<appender name="MainFormRichTextAppender" 
type="log4net.Appender.RichTextBoxAppender">

<appendToFile value="true" />

<maximumFileSize value="250000KB" />

<maxSizeRollBackups value="2" />

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

<conversionPattern value="%date [%-2thread] %-5level %-70logger - 
%message%newline" />

</layout>

<code lang="XML" escaped="true">

<mapping>

<level value="DEBUG" />

<textColorName value="DarkGreen" />

<fontFamilyName value="Microsoft Sans Serif"/>

<pointSize value="6.75" />

</mapping>

<mapping>

<level value="INFO" />

<textColorName value="Black" />

<fontFamilyName value="Microsoft Sans Serif"/>

<pointSize value="6.75" />

</mapping>

<mapping>

<level value="WARN" />

<textColorName value="Blue" />

<fontFamilyName value="Microsoft Sans Serif"/>

<pointSize value="6.75" />

</mapping>

<mapping>

<level value="ERROR" />

<textColorName value="Red" />

<!--<bold value="true" />-->

<fontFamilyName value="Microsoft Sans Serif"/>

<pointSize value="6.75" />

</mapping>

<mapping>

<level value="FATAL" />

<textColorName value="Black" />

<fontFamilyName value="Microsoft Sans Serif"/>

<pointSize value="6.75" />

</mapping>

</code>

</appender>

<root>

<level value="DEBUG" />

<appender-ref ref="BufferingForwardingAppender" />

<appender-ref ref="MainFormRichTextAppender"/>

</root>


________________________________

From: Michael Schall [mailto:mike.sch...@gmail.com] 
Sent: mercredi 25 février 2009 20:36
To: Log4NET User
Subject: Re: DEBUG vs INFO


What appenders are you using? I assume one of them is the rolling file 
appender?  How large is the log file produced with the setting at DEBUG vs 
INFO?  

If you need to keep the debug information you can look at the 
BufferingForwardingAppender.  The following will buffer 255 messages before 
writing to the file, unless there is a WARN or higher message, then the buffer 
is flushed immediately.  This should hopefully let the error message that 
crashes the system still make it to the log file.:)

 I don't know how your loggers are setup, but you can turn off at that level as 
well.  

<log4net>

<appender name="BufferingForwardingAppender" 
type="log4net.Appender.BufferingForwardingAppender" >
<bufferSize value="255" />
<lossy value="false" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="WARN"/>
</evaluator>
<appender-ref ref="RollingFile" />
</appender>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="..\..\log\web.log" />
<appendToFile value="true" />
<maximumFileSize value="100MB" />
<maxSizeRollBackups value="-1" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%5level [%date] [%thread] %-30.30logger{2} 
%message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="BufferingForwardingAppender" />
</root>
</log4net>

On Wed, Feb 25, 2009 at 8:31 AM, Walden H. Leverich <wald...@techsoftinc.com> 
wrote:


        Graham,
        
        That's not a log4net issue as much as it's an issue in your application.
        Sounds like your application (like many) makes lots of log.Debug()
        calls, to log, um, debug information. By switching the logging from
        DEBUG to INFO you've stopped all those log entries from being written to
        disk. Even more, if your app developers were smart about it, they
        checked the IsDebugEnabled property before making the log.Debug() call,
        so you're not even evaluating the parms to that call, and sometimes that
        can be quite expensive.
        
        So, it's a "known issue" that logging more stuff takes more time, but I
        wouldn't call it a bug.
        
        -Walden
        
        --
        Walden H Leverich III
        Tech Software
        (516) 627-3800 x3051
        wald...@techsoftinc.com
        http://www.TechSoftInc.com
        
        Quiquid latine dictum sit altum viditur.
        (Whatever is said in Latin seems profound.)
        


Ce message et ses pièces jointes (le "message") est destiné à l'usage
exclusif de son destinataire.
Si vous recevez ce message par erreur, merci d'en aviser immédiatement
l'expéditeur  et de le détruire ensuite. Le présent message  pouvant
être altéré à notre insu,  CALYON Crédit Agricole CIB
ne peut pas être engagé par son contenu. Tous droits réservés.

This message and/or any  attachments (the "message") is intended for
the sole use of its addressee.
If you are not the addressee, please immediately notify the sender and
then destroy the message.  As this message and/or any attachments may
have been altered without our knowledge,  its content  is not legally
binding on CALYON Crédit Agricole CIB. All rights reserved.

Reply via email to