[infinispan-commits] Infinispan SVN: r434 - trunk/bin.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Jun 10 19:30:52 EDT 2009
Author: manik.surtani at jboss.com
Date: 2009-06-10 19:30:52 -0400 (Wed, 10 Jun 2009)
New Revision: 434
Modified:
trunk/bin/cleanlogs.py
Log:
Modified: trunk/bin/cleanlogs.py
===================================================================
--- trunk/bin/cleanlogs.py 2009-06-10 23:11:28 UTC (rev 433)
+++ trunk/bin/cleanlogs.py 2009-06-10 23:30:52 UTC (rev 434)
@@ -5,6 +5,7 @@
import re
import subprocess
import os
+import sys
VIEW_TO_USE = '3'
INPUT_FILE = "infinispan.log"
@@ -19,8 +20,9 @@
break
def handle(l, expr):
- # print l
m = expr.match(l)
+ print "Using JGROUPS VIEW line:"
+ print " %s" % l
members = m.group(1).strip()
i = 1
for m in members.split(','):
@@ -28,19 +30,35 @@
new_addresses["CACHE%s" % i] = m.strip()
i += 1
-def main():
+def help():
+ print '''
+ INFINISPAN log file fixer. Makes log files more readable by replacing JGroups addresses with friendly names.
+ '''
- print """
+def usage():
+ print '''
+ Usage:
+ $ bin/cleanlogs.py <N> <input_file> <output_file>
- INFINISPAN Log file fixer. Makes log files more readable by replacing ugly JGroups addresses to more friendly CACHE1, CACHE2, etc addresses.
+ N: (number) the JGroups VIEW ID to use as the definite list of caches. Choose a view which has the most complete cache list.
+ input_file: path to log file to transform
+ output_file: path to result file
- Usage:
+ ** All arguments are mandatory!
+ '''
- $ bin/cleanlogs.py
+def main():
+ help()
- TODO: be able to specify which view to select as the correct one, and to specify input and output files.
+ ### Get args
+ if len(sys.argv) != 4:
+ usage()
+ sys.exit(1)
- """
+ VIEW_TO_USE = int(sys.argv[1])
+ INPUT_FILE = sys.argv[2]
+ OUTPUT_FILE = sys.argv[3]
+
expr = re.compile('.*Received new cluster view.*\|%s. \[(.*)\].*' % VIEW_TO_USE)
find(expr)
More information about the infinispan-commits
mailing list