Greetings,

I’m trying to get all of our uwsgi logs into JSON, but I’m finding that 
multiline messages (such as a python traceback) are not properly logged as a 
single event.

Ideally, the output would be structured something like this:

{
    "levelname": "ERROR",
    "asctime": "2014-01-16 13:43:30,213",
    "module": "middleware",
    "process": 17797,
    "thread": 139634478094080,
    "message": "Traceback (most recent call last):\n  File 
\"/var/virtualenvs/appname/local/lib/python2.7/site-packages/django/core/handlers/base.py\",
 line 114, in get_response\n    response = wrapped_callback(request, 
*callback_args, **callback_kwargs)\n”
}

But what is happening instead is that each newline of the python traceback is 
resulting in an entirely new log line, like this:

{ "timestamp": "2014/01/21 18:50:50", "fields": { "host": “test", "version": 
"2.0", "message": "Traceback (most recent call last):"} }
{ "timestamp": "2014/01/21 18:50:50", "fields": { "host": “test", "version": 
"2.0", "message": "  File 
\"/var/virtualenvs/appname/lib/python3.3/site-packages/sqlalchemy/engine/base.py\",
 line 867, in _execute_context"} }
{ "timestamp": "2014/01/21 18:50:50", "fields": { "host": “test", "version": 
"2.0", "message": "    context)"} }
{ "timestamp": "2014/01/21 18:50:50", "fields": { "host": “test", "version": 
"2.0", "message": "  File 
\"/var/virtualenvs/appname/lib/python3.3/site-packages/sqlalchemy/engine/default.py\",
 line 388, in do_execute"} }
{ "timestamp": "2014/01/21 18:50:50", "fields": { "host": “test", "version": 
"2.0", "message": "    cursor.execute(statement, parameters)"} }

Do you have any suggestions for getting properly escaped output of the full 
traceback within a single log event?

Thanks!
-- 
Jon Chappell

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to