我正在尝试做一些非常类似于此处解释的内容:https://sebest.github.io/post/protips-using-gunicorn-inside-a-docker-image/
我想让我的Flask app + gunicorn输出JSON格式的日志记录.我已经为Flask应用程序工作,但我似乎无法使用gunicorn.
这是我目前的输出:
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger pin code: 317-187-130
192.168.99.1 - - [12/Jan/2016 20:09:29] "GET /nothing HTTP/1.1" 404 -
{"asctime": "2016-01-12 20:20:25,541", "levelname": "WARNING", "module": "app", "funcName": "err", "lineno": 17, "message": "will assert false..."}
192.168.99.1 - - [12/Jan/2016 20:20:25] "GET /err HTTP/1.1" 500 -
Run Code Online (Sandbox Code Playgroud)
开始的行是正确记录为JSON {"asctime":的代码输出app.logger.warning('will assert false...').好极了.开头的行192.168.99.1是从我的gunicorn WSGI服务器输出的,令人沮丧的是,它们不是JSON格式的.
这是我用来启动gunicorn的命令:
gunicorn --log-config gunicorn_logging.conf -c …Run Code Online (Sandbox Code Playgroud) 下面是一个完整的 ODBC 程序。它所做的只是尝试使用完全限定的连接字符串打开与 SQLite 数据库的连接。我遇到的问题是,当启用 Unicode(使用SQLDriverConnectW()而不是SQLDriverConnect())时,我收到错误消息:
libc++abi.dylib: terminating with uncaught exception of type database_error: connect: IM002: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
Run Code Online (Sandbox Code Playgroud)
我的odbc.ini文件是空的,这是我的odbcinst.ini文件的内容:
[SQLite3]
Description=SQLite ODBC Driver
Driver=/usr/local/Cellar/sqliteodbc/0.9992/lib/libsqlite3odbc-0.9992.dylib
Setup=/usr/local/Cellar/sqliteodbc/0.9992/lib/libsqlite3odbc-0.9992.dylib
Threading=2
Run Code Online (Sandbox Code Playgroud)
在代码的顶部有一个#if 1可以在 Unicode 和非 Unicode 之间切换代码(将其更改#if 0为禁用 Unicode)。当我启用 Unicode 时,出现错误。当我禁用的Unicode,它的作品完美。有什么想法为什么 Unicode 版本的 connect 找不到我的 DSN?
/*
Build command:
clang++ -Wall -Werror \
-std=c++14 -stdlib=libc++ \
-I/usr/local/Cellar/unixodbc/2.3.2_1/include \
-L/usr/local/Cellar/unixodbc/2.3.2_1/lib -lodbc \
unittest.cpp …Run Code Online (Sandbox Code Playgroud)