I use v 2018 r1.1 on Windows 10 and call System.DebugLog as a way to debug my app. The problem is that the messages are not showing in the Messages section of Xojo. Is there a setting I can change that will allow me to see the messages ?
@Gilles Plante I have seen this, running 2017r3 and 2018r1 under MacOS. Calls to System.DebugLog that I know are being executed (I can see the I/O signals generated by the code, with an oscilloscope) are not being written to the message log.
[quote=389739:@Greg O’Lone]Is there a reason you’re not using the debugger?
[/quote]
When debugging a real-time system, breakpoints are sometimes not feasible and the DebugLog can be a big help.
@Greg O Reason is I do want to run the app for a while and the check what is logged without stopping and resuming. That’s something I do in VB 5/6, there the instruction is Debug.Print. Thing is it seems to be broken on Windows.
I have mentioned this before… But a while back I tried to use System.DebugLog and found as Julia did, that either messages never showed up, lagged way behind the event, or in some cases appeared out of order. So I gave up… and created my own solution.
While its not elegant, I found that it never lagged, never was out of order, and the performance hit to the running app was acceptable during testing/debugging (as in neglible)
I add this method to my code, and call it instead of “System.DebugLog”
Public Sub debug(msg As String,force as Boolean=false)
//return
Dim f As FolderItem
Dim t As TextOutputStream
f=specialfolder.desktop.child("name_of_my_program.trace_log")
If msg="!!!" Then
If f.exists Then f.delete
Exit Sub
End If
//
#If DebugBuild Then
force=True
#EndIf
If force Then
If Not f.exists Then
t=TextOutputStream.Create(f)
Else
t=TextOutputStream.Append(f)
End If
t.write Str(Ticks)+":"+msg+EndOfLine
t.close
End If
End Sub
Dave’s suggestion is great, I also use DebugView in windows. If you prepend your messages with a unique ID (i.e.app name) then you can filter those messages in DebugView to see messages from just your app and not system wide.
[quote=389756:@]I’ve noticed this too <https://xojo.com/issue/50232>
[/quote]
Norman’s reply seems to imply that this behavior is “by design” and makes me doubt that it will be fixed.
Yeah, I can understand it if there’s a lot of logs being created because at some point those logs are going to be pretty pointless if you’re trying to see things happen in “real time” which is why I specifically put in a ticket about it losing messages where I was only raising 5 messages and they were still being lost on app shutdown. Still Gilles doesn’t mention how many logs he’s creating but yes it looks like its not 100% guaranteed to see the messages unless you use some other sort of logging.
[quote=389756:@]I’ve noticed this too Feedback Case #50232
Dave’s suggestion is great, I also use DebugView in windows. If you prepend your messages with a unique ID (i.e.app name) then you can filter those messages in DebugView to see messages from just your app and not system wide.[/quote]
I thought this was/is the only way to go, since the system.debuglog pane did not feel handy and reliable to me for years already.