Skip to content

Commit

Permalink
Merge pull request #144 from ptnapoleon/master
Browse files Browse the repository at this point in the history
Display stack traces from log
  • Loading branch information
Sylvain Lebresne committed Aug 11, 2014
2 parents fa1e375 + 020a27f commit bdfab9b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ccmlib/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,27 @@ def grep_log(self, expr):
matchings.append((line, m))
return matchings

def grep_log_for_errors(self):
"""
Returns a list of errors with stack traces
in the Cassandra log of this node
"""
expr = "ERROR"
matchings = []
pattern = re.compile(expr)
with open(self.logfilename()) as f:
for line in f:
m = pattern.search(line)
if m:
matchings.append([line])
try:
while line.find("INFO", 0, 5) < 0:
line = f.next()
matchings[-1].append(line)
except StopIteration:
break
return matchings

def mark_log(self):
"""
Returns "a mark" to the current position of this node Cassandra log.
Expand Down

0 comments on commit bdfab9b

Please sign in to comment.