How to capture the shiny console log (as an alternative to the shinyapps.io logs)

Hello everyone, I'm hoping someone will have some expertise to share on this topic. My organization maintains a consumer-facing Shiny app that, unfortunately, crashes occassioanlly. We've made a Google form for users to report problems and errors so that we can bugfix, but by the time we we can check an error form, usually any log information that could help us has been overwritten because of the very short length that shinyapps.io allots to application logs. Does anyone know of an alternative to relying on these logs, or if shinyapps.io offers a way to increase our log length?

You can use the rsconnect package to access the log, on the computer that has the credentials and token to access and update the shiny app.

For example you can monitor the log with:

> Log = showLogs(appName = "YourApp", entries =100, streaming = TRUE)

In theory this can be written to another file then (maybe using "writeLines"?) but I don't have a full solution for this.

Thank you for your response, Matthias!

this works to get the logs in a form you can then writeLines with: https://github.com/rstudio/rsconnect/issues/377

appPath<-file.path(getwd(),"myapp")
appName<-"myapp"
target <- rsconnect:::deploymentTarget(appPath, appName, NULL, NULL, NULL)
accountDetails <- rsconnect:::accountInfo(target$account)
client <- rsconnect:::lucidClient(rsconnect:::shinyappsServerInfo()$url, accountDetails)
application <- rsconnect:::getAppByName(client, accountDetails, target$appName)
logs <- client$getLogs(application$id, 50)
cat(logs)