mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 09:32:21 +00:00
Merge pull request #48 from jjohnson42/debugsignals
Add facility to dump trace to log
This commit is contained in:
commit
d8c3b2f267
@ -50,6 +50,8 @@ except ImportError:
|
||||
import sys
|
||||
import os
|
||||
import signal
|
||||
import time
|
||||
import traceback
|
||||
|
||||
|
||||
def _daemonize():
|
||||
@ -119,6 +121,11 @@ def _checkpidfile():
|
||||
def terminate(signalname, frame):
|
||||
sys.exit(0)
|
||||
|
||||
def dumptrace(signalname, frame):
|
||||
ht = open('/var/log/confluent/hangtraces', 'a')
|
||||
ht.write('Dumping active trace on ' + time.strftime('%X %x\n'))
|
||||
ht.write(''.join(traceback.format_stack(frame)))
|
||||
ht.close()
|
||||
|
||||
def doexit():
|
||||
if not havefcntl:
|
||||
@ -138,6 +145,7 @@ def _initsecurity(config):
|
||||
|
||||
|
||||
def run():
|
||||
signal.signal(signal.SIGUSR1, dumptrace)
|
||||
if havefcntl:
|
||||
_checkpidfile()
|
||||
conf.init_config()
|
||||
|
Loading…
Reference in New Issue
Block a user