我想做一个日志监视器,所以它监视日志并解析日志,然后保存到数据库并通过 stomp 推送该数据。是的,它成功推送数据,但是在我推送数据后,我收到错误消息> "Alarm Clock" and the program stopped !
这是我的代码:
def sent_msg(msg,channel)
try:
stomp = Client(host="localhost", port=54123)
stomp.connect()
stomp.subscribe(channel)
signal.alarm(1)
stomp.put(msg, destination=channel)
signal.alarm(0)
except Exception,err:
print err
else:
print 'succes'
try:
msg = """
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
<td>%s</td>
"""%(ip,dt,time,ua,req)
sent_msg(msg,'/monitor_sqli')
except Exception, err:
print err
else:
print 'exist'