Skip to content
Browse files

Added tryCatch to file logging to avoid permissions issues in default…

… shiny-server configuration.
  • Loading branch information...
1 parent 6eb8975 commit 424a920054bd2bc8c695c35a104787ff19810c2a @trestletech committed Feb 8, 2013
Showing with 12 additions and 6 deletions.
  1. +6 −3 naiveGeyeser/server.R
  2. +6 −3 reactiveGeyeser/server.R
View
9 naiveGeyeser/server.R
@@ -1,8 +1,11 @@
log <- function(text, file="log.txt"){
- log <- file(file, "at")
- writeLines(text, con=log)
+ tryCatch({
+ log <- file(file, "at")
+ writeLines(text, con=log)
+ close(log)
+ }, error= function(e){}
+ )
print(text)
- close(log)
}
shinyServer(function(input, output) {
View
9 reactiveGeyeser/server.R
@@ -1,8 +1,11 @@
log <- function(text, file="log.txt"){
- log <- file(file, "at")
- writeLines(text, con=log)
+ tryCatch({
+ log <- file(file, "at")
+ writeLines(text, con=log)
+ close(log)
+ }, error= function(e){}
+ )
print(text)
- close(log)
}
shinyServer(function(input, output) {

0 comments on commit 424a920

Please sign in to comment.
Something went wrong with that request. Please try again.