PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Change the write path for My.Application.Log.WriteEntry?

Reply

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

 
Thread Tools Rate Thread
Old 13-01-2006, 03:36 PM   #1
=?Utf-8?B?UnVzc2VsbCBUaG9tYXM=?=
Guest
 
Posts: n/a
Default Change the write path for My.Application.Log.WriteEntry?


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?


  Reply With Quote
Old 13-01-2006, 05:58 PM   #2
Terry Olsen
Guest
 
Posts: n/a
Default Re: Change the write path for My.Application.Log.WriteEntry?

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 ***
  Reply With Quote
Old 13-01-2006, 07:10 PM   #3
=?Utf-8?B?UnVzc2VsbCBUaG9tYXM=?=
Guest
 
Posts: n/a
Default Re: Change the write path for My.Application.Log.WriteEntry?

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?

"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 ***
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off