应用程序没有将任何错误日志写入heroku上的stdout或stderr

时间:2016-12-14 18:40:40

标签: python logging heroku pyramid error-logging

我试图将应用程序从linode迁移到heroku。一切都运转正常,除了我没有在日志中出现错误。

根据heroku文档,写入stdout或stderr的任何内容都应该出现在日志中。

https://devcenter.heroku.com/articles/logging

根据uwsgi文档,除非有其他设置,否则默认情况下应将错误写入stdout。

https://uwsgi-docs.readthedocs.io/en/latest/Logging.html

我有一个返回内部服务器错误的页面:

Internal Server Error

The server encountered an unexpected internal server error

(generated by waitress)

但我根本没有在日志中得到任何东西。我没有什么可以解决的。

2016-12-14T16:56:58.846534+00:00 heroku[web.1]: State changed from starting to up
2016-12-14T16:57:06.401955+00:00 heroku[router]: at=info method=GET path="/manager/expenses?expense_group_id=1" host=singleentry-dev.herokuapp.com request_id=b5ce7308-7769-4412-b56a-aaa5bf0208f2 fwd="75.49.124.130" dyno=web.1 connect=1ms service=638ms status=200 bytes=64002
2016-12-14T16:57:08.572829+00:00 heroku[router]: at=info method=GET path="/manager/expense?expense_id=497" host=singleentry-dev.herokuapp.com request_id=d4bb8ba8-af50-4885-8dc1-a34e806e0ea1 fwd="75.49.124.130" dyno=web.1 connect=1ms service=186ms status=200 bytes=48970
2016-12-14T16:57:14.319986+00:00 heroku[router]: at=info method=POST path="/manager/upload_add" host=singleentry-dev.herokuapp.com request_id=74c4ac00-b5f8-4dcb-a13f-a90386e055e1 fwd="75.49.124.130" dyno=web.1 connect=1ms service=1402ms status=500 bytes=269

我不认为我的配置中有任何可能导致错误重定向到其他地方的内容。 production.ini:

###
# app configuration
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/environment.html
###

[app:main]
use = egg:corefinance


pyramid.reload_templates = false
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes =
    pyramid_debugtoolbar
    pyramid_tm
session.secret = x


# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 24.155.241.1

###
# wsgi server configuration
###

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 80

###
# logging configuration
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/logging.html
###

[loggers]
keys = root, corefinance, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_corefinance]
level = DEBUG
handlers =
qualname = corefinance

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither.  (Recommended for production systems.)

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

[uwsgi]
http = 0.0.0.0:80
die-on-term = 1
master = 1
#logto = /var/log/wsgi/uwsgi.log


enable-threads = true
offload-threads = N
py-autoreload = 1
wsgi-file = /var/www/finance/corefinance/wsgi.py

我目前陷入困境,无法前进,因为我无法弄清楚页面上的错误。有什么想法吗?

0 个答案:

没有答案