Added cmdline information into fluentFormatter event message

Since process_name value defaults to "MainProcess" a new field cmdline
has been added in order to get information which process (daemon)
triggers the event.

Change-Id: I1d7713ff7de930e40fc5b8ceb2cf2af54082c9cc
Closes-Bug: 1822101
This commit is contained in:
Jan Vondra 2019-03-28 14:02:06 +01:00
parent ee2c228dd2
commit ecbdb45c0a

View File

@ -301,6 +301,7 @@ class FluentFormatter(logging.Formatter):
self.hostname = socket.gethostname()
except socket.error:
self.hostname = None
self.cmdline = " ".join(sys.argv)
def formatException(self, exc_info, strip_newlines=True):
try:
@ -324,6 +325,7 @@ class FluentFormatter(logging.Formatter):
'module': record.module,
'funcname': record.funcName,
'process_name': record.processName,
'cmdline': self.cmdline,
'hostname': self.hostname,
'traceback': None,
'error_summary': _get_error_summary(record)}