How to open the log file for read?
"jgeng" <[email protected]> Wed, 4 Feb 2004 12:02:27 -0600
| Newsgroups | gmane.comp.windows.dotnet.log4net.user |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. ------=_NextPart_000_0066_01C3EB16.C70EF540 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit When the logfile is locked by the application, how can I open it for read-only in another application? I can open the logfile in Utraedit, notepad etc. But whenever I try to open it in my C# application, it throws exception. I am using following statement to open the logfile. FileStream fs = new FileStream(logfileName, FileMode.Open, FileAccess.Read); Is there anything wrong? Since the logfile can be opened in Notepad, I supposed it can be opened to read in my C# application also, right? but how? Thanks, ------=_NextPart_000_0066_01C3EB16.C70EF540 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>How to unlock the log file?</TITLE> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR></HEAD> <BODY> <DIV dir=3Dltr align=3Dleft><SPAN class=3D609365817-04022004><FONT = face=3D"Book Antiqua"=20 color=3D#800080>When the logfile is locked by the application, how can I = open it=20 for read-only in another application? I can open the logfile in = Utraedit,=20 notepad etc. But whenever I try to open it in my C# application, it = throws=20 exception. I am using following statement to open the=20 logfile.</FONT></SPAN></DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D609365817-04022004><FONT = face=3D"Book Antiqua"=20 color=3D#800080></FONT></SPAN> </DIV> <DIV dir=3Dltr align=3Dleft><SPAN class=3D609365817-04022004><FONT = face=3D"Book Antiqua"=20 color=3D#800080>FileStream fs =3D new FileStream(logfileName, = FileMode.Open,=20 FileAccess.Read);</FONT></SPAN></DIV> <DIV><SPAN class=3D609365817-04022004><FONT face=3D"Book Antiqua"=20 color=3D#800080></FONT></SPAN> </DIV> <DIV><SPAN class=3D609365817-04022004><FONT face=3D"Book Antiqua" = color=3D#800080>Is=20 there anything wrong? Since the logfile can be opened in Notepad, I = supposed it=20 can be opened to read in my C# application also, right? but=20 how?</FONT></SPAN></DIV> <DIV><SPAN class=3D609365817-04022004><FONT face=3D"Book Antiqua"=20 color=3D#800080></FONT></SPAN> </DIV> <DIV><SPAN class=3D609365817-04022004><FONT face=3D"Book Antiqua"=20 color=3D#800080>Thanks,</FONT></SPAN><SPAN = class=3D609365817-04022004></DIV> <DIV dir=3Dltr align=3Dleft><FONT face=3D"Book Antiqua"><BR><FONT=20 color=3D#800080></FONT></FONT></DIV></SPAN></BODY></HTML> ------=_NextPart_000_0066_01C3EB16.C70EF540-- ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn