The log file is saved under the working directory.
What this does correctly
- log_file and log_message() set up your logging function — nothing special here, just a helper that appends timestamped lines to a file.
- options(shiny.error = ...) registers a global hook. Whenever an error occurs anywhere in your app's reactive code and nothing catches it, Shiny calls this function before showing its default error UI to the user.
- geterrmessage() retrieves the text of whatever error condition was just raised — that's what gets written to the log.
Caveats to be aware of