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:
parent
0b54cd4623
commit
510973e1cd
1 changed files with 3 additions and 3 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue