mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-04-26 19:42:55 +08:00
Determine process at log-time, not startup-time.
This is because things like the fedmsg-hub are daemons, and will double-fork into the background. If we determine the process at startup time, that original process is long dead by the time we get to the first log statement.
This commit is contained in:
@@ -27,6 +27,9 @@ class ContextInjector(logging.Filter):
|
||||
"""
|
||||
|
||||
def filter(self, record):
|
||||
current_process = ContextInjector.get_current_process()
|
||||
current_hostname = socket.gethostname()
|
||||
|
||||
record.host = current_hostname
|
||||
record.proc = current_process
|
||||
record.pid = current_process.pid
|
||||
@@ -67,9 +70,6 @@ class ContextInjector(logging.Filter):
|
||||
return {'name': 'ContextInjector'}
|
||||
|
||||
|
||||
current_process = ContextInjector.get_current_process()
|
||||
current_hostname = socket.gethostname()
|
||||
|
||||
hefty_format = """Message
|
||||
-------
|
||||
[%(asctime)s][%(name)10s %(levelname)7s]
|
||||
|
||||
Reference in New Issue
Block a user