【问题标题】:Flask error logging file not updating on VPSFlask 错误日志文件未在 VPS 上更新
【发布时间】:2018-11-21 05:39:48
【问题描述】:

我正在关注 Digitalocean 上的本教程来设置我的 Web 应用程序。 https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-16-04

我可以在我的本地机器上运行我的代码并从错误日志中获取详细的回溯错误消息,即“flask.log”,但是这个文件没有在我使用的虚拟专用服务器上更新(Ubuntu-16 -04)。如何从我的 VPS 中获取 Flask 的回溯错误消息?

我使用的python环境是Anaconda。以下是我用来创建错误日志文件的代码。调试模式为假。

from flask import Flask
import logging

app = Flask(__name__)
app.config.from_object('project.settings')

filehandler = logging.FileHandler('flask.log')
filehandler.setLevel(logging.ERROR)
app.logger.setLevel(logging.ERROR)
app.logger.addHandler(filehandler)

【问题讨论】:

    标签: python logging flask digital-ocean vps


    【解决方案1】:

    原来程序在日志文件有机会更新之前就被杀死了,因为系统内存不足。我升级了VPS,问题解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-29
      • 2020-05-14
      • 2013-07-19
      • 2018-07-26
      • 1970-01-01
      • 2018-06-11
      • 2017-02-19
      • 2012-05-23
      相关资源
      最近更新 更多