Logging To Assist Debugging App Running in Xojo Cloud

How does one send logging information to a file, for example error_log, from an app running in Xojo Cloud for the purposes of debugging? The command line option --Logging isn’t an option for a deployed app and the documentation for:

System.log

doesn’t really address apps running in Xojo Cloud.

You can use the logging option by adding it to the args array in the App.Open event:

Args.AddRow "--logging=/full/path/to/file"

That said, you also have access to the actual Apache logs if you turn on SFTP and look in the Logs folder and this won’t affect the performance of your app.

BTW, what is it that you are trying to track down?

My app needs to refresh a google access token, so I want to confirm that it’s reading a json where the refresh token is stored. Locally I do it like this:

Dim jsonToken As New Chilkat.JsonObject
Dim success As Boolean
success = jsonToken.LoadFile("/Users/cottrell/Library/Application Support/MyAccessTokenFolder/googleSheets_with_refresh_token.json")
If (success <> True) Then
  System.DebugLog("Failed to load googleSheets.json")
  Return
End If

There’s currently no streaming log available on Xojo Cloud, but you could do this using ExecuteJavascript.

ExecuteJavascript("console.log('" + txt +"')")

And then if you open the developer tools in your browser, you would see them there.

This appears to work very well when called from a web control, such as the opening event of a web page, for example.

But is there a way to make it work within a module where I’m getting an error like this?

Module1.RefreshAccessToken, line 53
Static reference to instance method: call this on an instance of class WebControl.
WebControl.ExecuteJavaScript("console.log(5 + 6)")

Yeah it should exist on Session too.

if Session <> nil then
  Session.ExecuteJavascript("console.log('blah');")
end

This is going to be very useful. Thanks much.