Shiny 应用程序无法在没有日志文件的情况下在 Shiny 服务器上运行

问题描述 投票:0回答:3

我有一个在本地 R 服务器(端口 8787)上运行的应用程序。当我将其移至 Shiny Server(端口 3838)时,我收到消息

ERROR: An error has occurred. Check your logs or contact the app author for clarification.

并且

/var/log/shiny-server.log

中不存在日志文件

这是我的配置文件:

# Instruct Shiny Server to run applications as local user
run_as : HOME_USER:;

# Define a server that listens on port 3838
server {
  listen 3838;

#preserve_logs true;
  # Define a location at the base URL
 location / {

# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;

# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
preserve_logs true;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
 }
} 

有人可以检查我的配置文件吗?谢谢你

shiny shiny-server
3个回答
16
投票

显然,对于我的配置来说,清理错误消息默认为 true。 添加

options(shiny.sanitize.errors = FALSE) 
到您的应用程序。

在配置文件中(通常位于

/etc/shiny-server/shiny-server.conf
),放置

sanitize_errors false;
preserve_logs true;

在服务器内永久解决。


3
投票

Shiny 还会在控制台上转储错误和消息。 您可以通过在 Chrome 或 Opera 浏览器中按 Ctrl + Shift + J 来访问它。


0
投票

我也有同样的问题。在我的

server.R
中,我使用了另一个 R 文件:将其重命名为
"global.R"
后,一切正常。

我开始获取有关丢失包裹的有意义的日志。需要使用

install.package("x", lib = "/usr/local/lib/R/site-library")
安装软件包。
确保
"shiny"
用户或您在
/etc/shiny-server/shiny-server.conf
中指定的任何用户有权访问
/usr/local/lib/R/site-library

© www.soinside.com 2019 - 2024. All rights reserved.