11

I am trying to run a Shiny app on Digital Ocean and it looks like I still have space on the machine:

free
              total        used        free      shared  buff/cache   available
Mem:         500096       78316       54188        5712      367592      385688
Swap:             0           0           0

This is my OS settings:

eliavs:/srv/shiny-server# uname -a
Linux ubuntu-eliavs 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

After trying to connect to App I can see the log in the directory:

eliavs:/var/log/shiny-server# ls -la
total 12
drwxrwxrwx+ 2 shiny shiny  4096 Feb 27 08:35 .
drwxrwxrwx  8 root  syslog 4096 Feb 27 06:25 ..
-rw-r-----  1 shiny shiny   362 Feb 27 08:35 shiny-server-shiny-20170227-083550-38332.log

When i try to look at the log it seems like the file is not there:

cat shiny-server-shiny-20170227-083550-38332.log
cat: shiny-server-shiny-20170227-083550-38332.log: No such file or directory
root@ubuntu-eliavs:/var/log/shiny-server#

and then when i check again it is gone:

 ls -la
total 8
drwxrwxrwx+ 2 shiny shiny  4096 Feb 27 08:35 .
drwxrwxrwx  8 root  syslog 4096 Feb 27 06:25 ..
Oliver
  • 11,857
  • 2
  • 36
  • 42
eliavs
  • 2,306
  • 4
  • 23
  • 33
  • 1
    Were you able to solve this? I am facing the same disappearing log problem too. – chengvt Mar 06 '17 at 07:05
  • @chengvt no not yet can you add info on your situation maybe it will help – eliavs Mar 07 '17 at 07:15
  • thanks for your reply! I resorted to debugging manually and found a library that wasn't installed so the problem was solved without looking at the disappearing log. – chengvt Mar 07 '17 at 07:47

2 Answers2

19

I ran into this problem yesterday after updating to shiny v1.5.3.838. I had to change the permissions on the logging directories to match the 'shiny' user. When attempting to solve some bugs in some old apps, I noticed the log files just vanish. To fix this I added the line:

    preserve_logs true; 

to the shiny-server.conf file at the top level.

This was enough for me to fix my errors and move on, so I don't know the reason why they vanish.

Jon Bramble
  • 326
  • 3
  • 6
  • It seems shiny-server knows how to *make* the log file, it just doesnt know how to *keep* the logfile! Why isnt this the default anyways? – reisner Jun 06 '19 at 21:30
  • 3
    From the documentation: "Be aware that this will cause log files to accumulate very quickly on a busy server. This setting is only recommended for debugging purposes; if it were to be enabled on a production server, you would need to pay close attention to the rotation and archiving of logs to prevent your file system becoming overwhelmed with log files." – hjonas Jan 17 '20 at 14:56
  • 4
    This new line should be before the "server {" line. – queise Oct 06 '20 at 16:06
5

The same thing was happening to me. I fixed it by changing my Shiny app to be owned by the shiny server's process, i.e.

cd /srv/shiny-server
sudo chown -R shiny:shiny myAppFolder

Before I changed myAppFolder to be owned by shiny:shiny, myAppFolder was owned by root:root and I was having the disappearing log problem. After I changed myAppFolder to be owned by shiny:shiny, the logs stopped disappearing and I was able to view them.