Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Commit

Permalink
adding the application logs to the stdout (#43)
Browse files Browse the repository at this point in the history
* add xtail package installation

* redirect application-level logs to stdout

* add switcher for app-logs-to-stdout feature; update README.md

* push app logs to stdout by default
  • Loading branch information
smnbbrv authored and cboettig committed Aug 24, 2018
1 parent 201c5c4 commit 95339e7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y \
libcurl4-gnutls-dev \
libcairo2-dev \
libxt-dev \
xtail \
wget

# Download and install shiny server
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ docker run --user shiny -p 3838:3838 --rm rocker/shiny

### Logs

As of January 2017, the Shiny Server log is written to `stdout` and can be viewed using `docker logs`. The logs for individual apps are in the `/var/log/shiny-server` directory, as described in the [Shiny Server Administrator's Guide]( http://docs.rstudio.com/shiny-server/#application-error-logs)
The Shiny Server log and all application logs are written to `stdout` and can be viewed using `docker logs`.

The logs for individual apps are still kept in the `/var/log/shiny-server` directory, as described in the [Shiny Server Administrator's Guide]( http://docs.rstudio.com/shiny-server/#application-error-logs). If you want to avoid printing the logs to STDOUT, set up the environment variable `APPLICATION_LOGS_TO_STDOUT` to `false` (`-e APPLICATION_LOGS_TO_STDOUT=false`).


### With docker-compose

Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ services:
# run on the localhost:80 "Welcome to Shiny" diagnostics page mentioned
# below.
user: 'root'
# Uncomment the lines below to disable application logs STDOUT output
# environment:
# - APPLICATION_LOGS_TO_STDOUT=false
ports:
- '80:3838'
volumes:
Expand Down
11 changes: 10 additions & 1 deletion shiny-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@
mkdir -p /var/log/shiny-server
chown shiny.shiny /var/log/shiny-server

exec shiny-server 2>&1
if [ "$APPLICATION_LOGS_TO_STDOUT" = "false" ];
then
exec shiny-server 2>&1
else
# start shiny server in detached mode
exec shiny-server 2>&1 &

# push the "real" application logs to stdout with xtail
exec xtail /var/log/shiny-server/
fi

0 comments on commit 95339e7

Please sign in to comment.