--- Ron Grabowski <[EMAIL PROTECTED]> wrote:

> I think a better starting point would be to write a
> BufferedRenderedMessageLengthFileAppender (long name!) and put the
> bufferLength property on that. 

This seemed to work too. It buffers writes to a FileAppender in 25k
chunks.

public class ExclusiveLock25k : FileAppender.LockingModelBase
{
 // copy the contents of the ExclusiveLock class because 
 // its m_stream field is private

 public override void OpenFile(string filename, bool append,Encoding
encoding)
 {

  // snip 

  m_stream = new FileStream(filename, fileOpenMode, FileAccess.Write,
FileShare.Read, 25000); 
 } 
}

<appender name="FileAppender" type="log4net.Appender.FileAppender">
 <file value="25kBufferedLogs.txt" />
 <appendToFile value="false" />
 <layout type="log4net.Layout.PatternLayout" />
 <lockingModel type="Company.Logging.ExclusiveLock25k, Company.Logging"
/>
 <immediateFlush value="false" />
</appender>

I think the default value for a FileStream is 4k.

Reply via email to