Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
534 views
in Technique[技术] by (71.8m points)

django - 有没有办法在uwsgi django日志中打印用户ID?(Is there a way of printing user id in uwsgi django log?)

I think it would be very convenient to have a user-id in the uwsgi request/response log.

(我认为在uwsgi请求/响应日志中具有user-id将非常方便。)

I know there's logformat option available in uwsgi.

(我知道logformat有可用的logformat选项。)

And I don't think user-id could be handled by logformat since it's not something uwsgi natively knows, it's app (my case django)'s data that runs inside uwsgi (if that expression makes sense)

(而且我认为user-id不能由logformat处理,因为uwsgi本身并不知道,因为它是app(在我的情况下为django)的数据在uwsgi中运行(如果该表达式有意义))

On the other hand, there's django logger's format and I guess I could make a middleware that prints a request/response data with user-id although this would be duplication of what uwsgi itself is logging.

(另一方面,有django logger的format ,我想我可以制作一个中间件来打印带有user-id的请求/响应数据,尽管这将是uwsgi本身正在记录的内容的重复。)

(although uwsgi's log don't have user-id )

((尽管uwsgi的日志没有user-id ))

So is there a way for uwsgi logformat or similar option to take the app(django)'s data into the log?

(那么,是否有办法让uwsgi logformat或类似的选项将应用程序(django)的数据放入日志?)

  ask by eugene translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...