Append not working - What am I missing?

Hi gang,

I am trying to log actions users take in my Web App and the append function doesn’t seem to be working. Here is the routine.

Dim t As TextOutputStream
Dim f As FolderItem
dim d as new Date

f = GetFolderItem(“userlog.txt”)
If f <> Nil Then
t = TextOutputStream.Append(f)
t.Write("Successful Login " + d.SQLDateTime + " ID = " + str(Lcid) + chr(13))
End If

The file gets written, but it is always the first line, the next entry just replaces the first line again. No Append.
I have tried t.Write and t.WriteLine with no difference.




I just ran into this! You are creating the file alongside the debug app, so the file is deleted every time you run the app anew (I think). You can confirm my theory by temporarily using a different location like:

f = SpecialFolder.Desktop.Child( "userlog.txt" )

You never cease to amaze me Kem.

That was it. Not sure why it is behaving the way it is, but when I move the file, or run the compiled version it works fine.

Many thanks!


When you Run the project from the IDE, it creates a subfolder and builds the executable in the subfolder. That is where the file is being created. When you quit the debug session, the subfolder is removed along with all its contents, including your file. So every time you run from the IDE, it’s creating a brand new file, which is then deleted when you quit.

Unles you set it otherwise in the IDE.

How would you set it otherwise?