r109401 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109400‎ | r109401 | r109402 >
Date:17:11, 18 January 2012
Author:oren
Status:deferred
Tags:
Comment:
maven project layout - moving from / to /src/main/python
may be runnable via jython...
Modified paths:
  • /trunk/lucene-search-3/src/main/python (added) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/main/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