r109397 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109396‎ | r109397 | r109398 >
Date:16:58, 18 January 2012
Author:oren
Status:deferred
Tags:
Comment:
maven project layout
Modified paths:
  • /trunk/lucene-search-3/python (added) (history)

Diff [purge]

Index: trunk/lucene-search-3/python/udplogger.py
@@ -0,0 +1,29 @@
 2+import socket, traceback
 3+
 4+file = 'searchqueries'
 5+
 6+host = ''
 7+port = 51234
 8+
 9+s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
 10+s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
 11+s.bind((host, port))
 12+
 13+out = open(file, 'a')
 14+
 15+print('Logging search queries on UDP port %d into file %s' % (port,file))
 16+
 17+while 1:
 18+ try:
 19+ # receive a message and write it to log file
 20+ message, address = s.recvfrom(8192)
 21+ out.write(message)
 22+ out.flush()
 23+ except (KeyboardInterrupt, SystemExit):
 24+ out.close()
 25+ raise
 26+ except:
 27+ traceback.print_exc()
 28+
 29+
 30+

Status & tagging log