mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
tornado: Log shard id in all logs coming from tornado processes.
This will make it easier to investigate using logs which requests are being processed by which Tornado process.
This commit is contained in:
committed by
Tim Abbott
parent
5cb476e03d
commit
3b5b19fde8
@@ -161,11 +161,18 @@ def find_log_origin(record: logging.LogRecord) -> str:
|
||||
module_name = find_log_caller_module(record)
|
||||
if module_name == logger_name or module_name == record.name:
|
||||
# Abbreviate a bit.
|
||||
return logger_name
|
||||
pass
|
||||
else:
|
||||
return '{}/{}'.format(logger_name, module_name or '?')
|
||||
else:
|
||||
return logger_name
|
||||
logger_name = '{}/{}'.format(logger_name, module_name or '?')
|
||||
|
||||
if settings.RUNNING_INSIDE_TORNADO:
|
||||
# In multi-sharded Tornado, it's often valuable to have which shard is
|
||||
# responsible for the request in the logs.
|
||||
from zerver.tornado.ioloop_logging import logging_data
|
||||
shard = logging_data.get('port', 'unknown')
|
||||
logger_name = "{}:{}".format(logger_name, shard)
|
||||
|
||||
return logger_name
|
||||
|
||||
log_level_abbrevs = {
|
||||
'DEBUG': 'DEBG',
|
||||
|
||||
Reference in New Issue
Block a user