【问题标题】:How to look Gunicorn logs when it running?运行时如何查看 Gunicorn 日志?
【发布时间】:2019-11-25 18:29:42
【问题描述】:

我将 Flask 应用程序部署到 VPS,并使用 Gunicorn 作为 Web 服务器。 我使用以下命令运行 Gunicorn 服务器:

gunicorn --bind=0.0.0.0 run:app --access-logfile '-'

通过该命令,我可以看到正在运行的日志。但是在我关闭终端会话后,我想再次查看运行日志。

在 Heroku 中我可以使用 heroku logs -t 来做到这一点,任何类似的方式可以在 Gunicorn 上看到它......?

【问题讨论】:

    标签: heroku logging flask server gunicorn


    【解决方案1】:

    您需要设置主管。主管保持您的服务器运行模式并保存您的日志。在下面设置主管文件,然后您可以看到日志:

    [program:your_project_name]
    command=/home/your_virualenv/bin/gunicorn --log-level debug 
    run_apiengine:main_app --bind 0.0.0.0:5007 --workers 2 --worker-class gevent
    directory=your_project_directory
    stdout_logfile= your_log_folder_path/supervisor_stdout.log
    stderr_logfile= your_log_folder_path/supervisor_stderr.log
    user=your_user
    autostart=true
    PYTHONPATH="$PYTHONPATH:your_python_path";OAUTHLIB_INSECURE_TRANSPORT='1';
    

    【讨论】:

      猜你喜欢
      • 2022-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多