[infinispan-commits] Infinispan SVN: r430 - trunk/bin.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Jun 10 17:23:16 EDT 2009
Author: manik.surtani at jboss.com
Date: 2009-06-10 17:23:15 -0400 (Wed, 10 Jun 2009)
New Revision: 430
Added:
trunk/bin/cleanlogs.py
Removed:
trunk/bin/fixlogs.py
Log:
Copied: trunk/bin/cleanlogs.py (from rev 429, trunk/bin/fixlogs.py)
===================================================================
--- trunk/bin/cleanlogs.py (rev 0)
+++ trunk/bin/cleanlogs.py 2009-06-10 21:23:15 UTC (rev 430)
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+
+from __future__ import with_statement
+
+import re
+import subprocess
+import os
+
+VIEW_TO_USE = '3'
+INPUT_FILE = "infinispan.log"
+OUTPUT_FILE = "infinispan0.log"
+addresses = {}
+new_addresses = {}
+def find(expr):
+ with open(INPUT_FILE) as f:
+ for l in f:
+ if expr.match(l):
+ handle(l, expr)
+ break
+
+def handle(l, expr):
+ # print l
+ m = expr.match(l)
+ members = m.group(1).strip()
+ i = 1
+ for m in members.split(','):
+ addresses[m.strip()] = "CACHE%s" % i
+ new_addresses["CACHE%s" % i] = m.strip()
+ i += 1
+
+def main():
+
+ print """
+
+ INFINISPAN Log file fixer. Makes log files more readable by replacing ugly JGroups addresses to more friendly CACHE1, CACHE2, etc addresses.
+
+ Usage:
+
+ $ bin/fixlogs.py
+
+ TODO: be able to specify which view to select as the correct one, and to specify input and output files.
+
+ """
+ expr = re.compile('.*Received new cluster view.*\|%s. \[(.*)\].*' % VIEW_TO_USE)
+ find(expr)
+
+ with open(INPUT_FILE) as f_in:
+ with open(OUTPUT_FILE, 'w+') as f_out:
+ for l in f_in:
+ for c in addresses.keys():
+ l = l.replace(c, addresses[c])
+ f_out.write(l)
+
+ print "Processed %s and generated %s. The following replacements were made: " % (INPUT_FILE, OUTPUT_FILE)
+ sorted_keys = new_addresses.keys()
+ sorted_keys.sort()
+ for a in sorted_keys:
+ print " %s --> %s" % (new_addresses[a], a)
+
+if __name__ == "__main__":
+ main()
Deleted: trunk/bin/fixlogs.py
===================================================================
--- trunk/bin/fixlogs.py 2009-06-10 21:22:53 UTC (rev 429)
+++ trunk/bin/fixlogs.py 2009-06-10 21:23:15 UTC (rev 430)
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-
-from __future__ import with_statement
-
-import re
-import subprocess
-import os
-
-VIEW_TO_USE = '3'
-INPUT_FILE = "infinispan.log"
-OUTPUT_FILE = "infinispan0.log"
-addresses = {}
-new_addresses = {}
-def find(expr):
- with open(INPUT_FILE) as f:
- for l in f:
- if expr.match(l):
- handle(l, expr)
- break
-
-def handle(l, expr):
- # print l
- m = expr.match(l)
- members = m.group(1).strip()
- i = 1
- for m in members.split(','):
- addresses[m.strip()] = "CACHE%s" % i
- new_addresses["CACHE%s" % i] = m.strip()
- i += 1
-
-def main():
-
- print """
-
- INFINISPAN Log file fixer. Makes log files more readable by replacing ugly JGroups addresses to more friendly CACHE1, CACHE2, etc addresses.
-
- Usage:
-
- $ bin/fixlogs.py
-
- TODO: be able to specify which view to select as the correct one, and to specify input and output files.
-
- """
- expr = re.compile('.*Received new cluster view.*\|%s. \[(.*)\].*' % VIEW_TO_USE)
- find(expr)
-
- with open(INPUT_FILE) as f_in:
- with open(OUTPUT_FILE, 'w+') as f_out:
- for l in f_in:
- for c in addresses.keys():
- l = l.replace(c, addresses[c])
- f_out.write(l)
-
- print "Processed %s and generated %s. The following replacements were made: " % (INPUT_FILE, OUTPUT_FILE)
- sorted_keys = new_addresses.keys()
- sorted_keys.sort()
- for a in sorted_keys:
- print " %s --> %s" % (new_addresses[a], a)
-
-if __name__ == "__main__":
- main()
More information about the infinispan-commits
mailing list