Counting number of methods causing an error in Python : <p>I have a Python log file (let's call it <code>logfile.log</code>) with a bunch of Python errors. There's one particular error being caused by several different methods (let's call it <code>blah blah error</code>). The entries look something like this:</p>

<pre><code>CRITICAL - Unexpected Error: blah blah error
Traceback (most recent call last):
  File "example1.py", line 100, in method1
  File "example2.py", line 200, in method2
  File "example3.py", line 300, in method3
pythonerror.Error: blah blah error
</code></pre>

<p>In the sample above, the source of the error - <code>method3</code> - can be several different methods. I want to go through the entire log file and count how many times each method appears in one of these errors, if it appears at all. Is this possible using regex? What would I need to do to accomplish this?</p>

<p>NOTE: The log file doesn't only contain this particular error, so the method might appear in other errors. I want to get the count of it only if it's within that particular error and only if it's the source of the error (second to last line in the above example).</p>
