Is there a way to include/print information into a shiny-server log file?
I am working with a shiny app which includes an user login and if my app crashes I would like to know what user caused this crash.
I tried to include this into my server.R
:
#PRINT FOR LOG FILE------------
cat(paste0("Username: ",userdata$name, "\n"))
cat(paste0("Datum: ",Sys.time(), "\n"))
But it doesn't work. Any ideas?
Add file=stderr()
parameter to your cat
:
cat(file=stderr(), paste0("Username: ",userdata$name, "\n"))
cat(file=stderr(), paste0("Datum: ",Sys.time(), "\n"))
As noted in this article:
A note about
stderr()
: in most casescat("my output")
(i.e. printing to standard out) will work correctly, but in others (e.g. inside arenderPrint
, which usescapture.output
to redirect output), it won’t, so we recommend always sending trace output tostderr()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With