Hello,

 

I have an WinForms application in C# that generates data files for a
graphing application.  This application uses log4net to log progress,
information, errors, etc.  I also want this application to be able to
view the log file.  When I try to open the log file I get the following
error message:

 

The process cannot access the file "C:\....\MyApplication.log" because
it is being used by another process.

 

I searched Google and found that I should add the following line to my
configuration file:

 

<lockingModel type="log4net.Appender.FileAppender+MinimalLock\" />

 

Adding this does not seem to allow access to log file.  I expected to be
able to open the log file in Notepad by double-clicking on it but that
also generates the same error.  I want to be able to have my application
open the log file and display the contents in a TextBox but I get the
same error when I try that as well.

 

I am using:

Visual Studio 2005 Professional

Microsoft .NET Framework 2.0

log4net v1.2.10.0

Windows XP Pro w/SP2

 

Here is my configuration file:

 

<?xml version="1.0" encoding="utf-8" ?>

<log4net>

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

    <file value="MyApplication.log" />

    <appendToFile value="true" />

    <maximumFileSize value="100KB" />

    <maxSizeRollBackups value="2" />

    

    <lockingModel type="log4net.Appender.FileAppender+MinimalLock\" />

 

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

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

    </layout>

  </appender>

 

  <root>

    <level value="DEBUG" />

    <appender-ref ref="RollingFile" />

  </root>

</log4net>

 

Am I missing something here?

 

Thanks,

 

Randall Price

Secure Enterprise Technology Initiatives

Microsoft Implementation Group

Virginia Tech Information Technology

1700 Pratt Drive

Blacksburg, VA  24060

Email:      [EMAIL PROTECTED]

Phone:     (540) 231-4396

 

Reply via email to