Home All Groups Group Topic Archive Search About

Change the write path for My.Application.Log.WriteEntry?

Author
13 Jan 2006 3:36 PM
Russell Thomas
I've been working with the My.Application.Log.WriteEntry method in VB.net
2005 and when it writes a log is stores the log file in the application data
folder under the systems user account.  I have tried to find a way to change
this path to save the log to a different location but i can't find it.  Has
anyone dealt with this b4?  I have read the MSDN documentation and searched
online but have been unsuccesful in finding any way to do this.  Any
suggestions?

Author
13 Jan 2006 5:58 PM
Terry Olsen
I have always used a simple log routine that writes to a log file in my
application's directory.

Private Sub WriteLogEntry(ByVal msg as String)
dim sw as new StreamWriter(".\myapp.log",True)
sw.writeline(now.toshortdatestring & " " & _
             now.toshorttimestring & " - " & msg)
sw.close
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Author
13 Jan 2006 7:10 PM
Russell Thomas
Terry thank you for responding to my post.
I agree that your solution for creating my own log files will do what i need
it to do and I will most likely end up doing it that way if i can't find an
answer.  I'm specifically interested in the My.Application.Log.WriteEntry to
see if I wanted to change the way i was doing things and while i do like the
method, I don't like that i can't change the path of where it writes the log
and wanted to see if anyone has solved it?

Show quoteHide quote
"Terry Olsen" wrote:

> I have always used a simple log routine that writes to a log file in my
> application's directory.
>
> Private Sub WriteLogEntry(ByVal msg as String)
> dim sw as new StreamWriter(".\myapp.log",True)
> sw.writeline(now.toshortdatestring & " " & _
>              now.toshorttimestring & " - " & msg)
> sw.close
> End Sub
>
> *** Sent via Developersdex http://www.developersdex.com ***
>