In fact, I’ve just tried adding this to my config directives and still the same 
effect!

<immediateflush value="true" />

From: Cook, Henri
Sent: 24 October 2011 15:49
To: Log4NET User
Subject: RE: Turning off buffered IO for the RollingFileAppenders

Hi Chun Kit,

Thanks for your response! I am using a tail program but I’ve never observed 
chunking in the past, additionally whenever I stop my c# Application (just 
running in debug with F5 in Visual studio, stopped with shift+F5) the log 
suddenly gets written en-masse – so it’s like it’s cached somewhere and flushed 
on close.

In fact I’ve just confirmed this with Notepad++ - the file doesn’t get written 
until I shift+F5

Weird, no?

From: Lee Chun Kit [mailto:chunki...@gmail.com]
Sent: 24 October 2011 14:59
To: Log4NET User
Subject: Re: Turning off buffered IO for the RollingFileAppenders

The RollingFileAppender shouldn't be buffering by default as the default value 
of the ImmediateFlush property it inherits from the TextWriterAppender is true 
[1].

Could it be the case that you are observing the log entries using a "tail" 
program which refreshes the log file after a period of around 20-30 log entries?

[1] 
http://logging.apache.org/log4net/release/sdk/log4net.Appender.TextWriterAppender.ImmediateFlush.html

Regards,
Chun Kit
On Mon, Oct 24, 2011 at 8:47 PM, Cook, Henri 
<henri.c...@itn.co.uk<mailto:henri.c...@itn.co.uk>> wrote:
Morning Log4Netters!

I’m a recent convert to the Log4Net way and I’ve implemented myself a 
RollingFileAppender as below – what I can’t seem to do is stop it buffering! 
I’m trying to debug a live transfer process using log entries and having it 
batch 20-30 log entries before writing them to file is a bit limiting. I’ve 
found lots of entries in Log4j documentation about a ‘bufferedIO’ flag which 
I’ve tried to set but with debugging on it says log4net can’t find it as a 
parameter. Is anyone able to assist?

Thanks in advance,

Henri

<log4net>
    <appender name="RollingAppender" 
type="log4net.Appender.RollingFileAppender">
      <file type="log4net.Util.PatternString" 
value="C:\ITN\Logs\ITNService.log"/>
      <appendToFile value="true"/>
      <staticLogFileName value="true"/>
      <rollingStyle value="Date"/>
      <maxSizeRollBackups value="7"/>
      <datePattern value="yyyyMMdd"/>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%d [%t] %-5p %m%n"/>
      </layout>
    </appender>
    <logger name="Logger">
      <appender-ref ref="RollingAppender" />
    </logger>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="RollingAppender" />
    </root>
  </log4net>




Error! Filename not specified.

HENRI COOK
DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4545<tel:%2B44%20%280%2920%207430%204545>
F
E henri.c...@itn.co.uk<mailto:henri.c...@itn.co.uk>
WWW.ITN.CO.UK<http://WWW.ITN.CO.UK>
P  Please consider the environment. Do you really need to print this email?


Please Note:

Any views or opinions are solely those of the author and do not necessarily 
represent those of Independent Television News Limited unless specifically 
stated. This email and any files attached are confidential and intended solely 
for the use of the individual or entity to which they are addressed. If you 
have received this email in error, please notify 
postmas...@itn.co.uk<mailto:postmas...@itn.co.uk>

Please note that to ensure regulatory compliance and for the protection of our 
clients and business, we may monitor and read messages sent to and from our 
systems.

Thank You.

Please Note:

Any views or opinions are solely those of the author and do not necessarily 
represent those of Independent Television News Limited unless specifically 
stated. This email and any files attached are confidential and intended solely 
for the use of the individual or entity to which they are addressed. If you 
have received this email in error, please notify postmas...@itn.co.uk

Please note that to ensure regulatory compliance and for the protection of our 
clients and business, we may monitor and read messages sent to and from our 
systems.

Thank You.
Please Note:

Any views or opinions are solely those of the author and do not necessarily 
represent those of Independent Television News Limited unless specifically 
stated. This email and any files attached are confidential and intended solely 
for the use of the individual or entity to which they are addressed. If you 
have received this email in error, please notify postmas...@itn.co.uk 

Please note that to ensure regulatory compliance and for the protection of our 
clients and business, we may monitor and read messages sent to and from our 
systems.

Thank You.

Reply via email to