Return-Path: Delivered-To: apmail-logging-log4net-user-archive@www.apache.org Received: (qmail 99380 invoked from network); 5 Apr 2007 19:38:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Apr 2007 19:38:22 -0000 Received: (qmail 34597 invoked by uid 500); 5 Apr 2007 19:38:27 -0000 Delivered-To: apmail-logging-log4net-user-archive@logging.apache.org Received: (qmail 34577 invoked by uid 500); 5 Apr 2007 19:38:27 -0000 Mailing-List: contact log4net-user-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET User" List-Id: Delivered-To: mailing list log4net-user@logging.apache.org Received: (qmail 34566 invoked by uid 99); 5 Apr 2007 19:38:27 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2007 12:38:27 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of randallp@vt.edu designates 198.82.160.18 as permitted sender) Received: from [198.82.160.18] (HELO rivendell.cc.vt.edu) (198.82.160.18) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Apr 2007 12:38:19 -0700 Received: from elessar.cc.vt.edu ([198.82.160.22]) by rivendell.cc.vt.edu with Microsoft SMTPSVC(5.0.2195.6713); Thu, 5 Apr 2007 15:37:58 -0400 X-MIMEOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: FileAppender+MinimalLock not working as expected - FIXED!! Date: Thu, 5 Apr 2007 15:37:54 -0400 Message-ID: <4C058118EC56B34E809904A5D0DA308701C5A7FD@elessar.cc.w2k.vt.edu> In-reply-to: <003301c777a0$90d04730$660ea8c0@telebill.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: FileAppender+MinimalLock not working as expected - FIXED!! Thread-index: Acd3Bq4//JiHwudHSb2MzWB2WZ3FpwAfsa/gAAVVASAAAEIXIAAA2I8gAAYreoA= References: <4C058118EC56B34E809904A5D0DA308701C5A749@elessar.cc.w2k.vt.edu> <003301c777a0$90d04730$660ea8c0@telebill.net> From: "Price, Randall" To: "Log4NET User" X-OriginalArrivalTime: 05 Apr 2007 19:37:58.0062 (UTC) FILETIME=[E9ECE4E0:01C777B9] X-Virus-Checked: Checked by ClamAV on apache.org Marc, Thanks for your response but I could not read the log file when I removed the MinimalLock entry from the config file and tried using the File.OpenRead() statement you recommended. But it was worth a shot... Randall Price -----Original Message----- From: Marc Lewandowski [mailto:marc@telebill.com]=20 Sent: Thursday, April 05, 2007 12:37 PM To: 'Log4NET User' Subject: RE: FileAppender+MinimalLock not working as expected - FIXED!! I don't think the problem was really the MinimalLock at all (ultimately). For instance, I can view a log file in Notepad, and it will continue to be updated, without using MinimalLock (confirm this for yourself). The problem is how you are opening the file. I believe the StreamReader constructor attempts to gain exclusivity on the file by default (from MS docs for File.OpenText(): "This method is equivalent to StreamReader( string )"). Try: StreamReader sr =3D new StreamReader( File.OpenRead( strFileName ) ); instead, even without the MinimalLock. Let us know how you make out. -Marc -----Original Message----- From: Price, Randall [mailto:randallp@vt.edu]=20 Sent: Thursday, April 05, 2007 12:05 PM To: Log4NET User Subject: RE: FileAppender+MinimalLock not working as expected - FIXED!! FYI, I got this working by fixing a typo in the config file. I had When I should have had Notice the stray backslash at the end -- that came from a cut and paste from an article I found on Google that had the stray backslash in the code. Now I can successfully have my application open and display its own log file. Guess this has been a blonde Monday for me!! Thanks for all who responded. Randall Price -----Original Message----- From: Price, Randall [mailto:randallp@vt.edu]=20 Sent: Thursday, April 05, 2007 11:58 AM To: Log4NET User Subject: RE: FileAppender+MinimalLock not working as expected An update on this... I noticed that I can have the log file open in Notepad and run my application with no problem. The log file gets updated even with it open in Notepad!! When I close Notepad and then reopen the log file I can see the new log entries. However, I can still not get my application to open its log file. I still get the error "process cannot access ... being used by another process". Does anyone have an application working that can view its own log file or know how to get this to work? Thanks, Randall Price -----Original Message----- From: Price, Randall [mailto:randallp@vt.edu]=20 Sent: Thursday, April 05, 2007 9:24 AM To: Log4NET User Subject: RE: FileAppender+MinimalLock not working as expected - Correction! Here is the code to open and read the log file: StreamReader sr =3D new StreamReader(strFileName); string strData =3D sr.ReadToEnd(); sr.Close(); txtData.Text =3D strData; As you can see I am not doing anything complex, just opening the file and reading the contents into a TextBox. Randall Price -----Original Message----- From: Ron Grabowski [mailto:rongrabowski@yahoo.com]=20 Sent: Wednesday, April 04, 2007 6:15 PM To: Log4NET User Subject: Re: FileAppender+MinimalLock not working as expected - Correction! How are you trying to open the file in code? ----- Original Message ---- From: "Price, Randall" To: Log4NET User Sent: Wednesday, April 4, 2007 4:49:27 PM Subject: RE: FileAppender+MinimalLock not working as expected - Correction! When my WinForms application is running I CAN double-click on the log file from Windows Explorer and open the log file in Notepad. =20 But when I click my View Log File button on my application, I get the "process cannot access ... being used by another process" error message. However process should be the same process making the request to open the file for reading. =20 Has anyone ever done something like this before?=20