The Structure of Exception Stack Trace Data

There is no need to hold every single exception that I come across, only a counter of all occurrences of any particular type of exception along with details for that type. As previously discussed, an exception stack trace can be dissected into these parts:

• The exception head line (the first line of the exception stack trace).

• The exception body (the stack trace).

In addition to this information, I also need to have the following:

• A counter to count the number of occurrences of each particular type.

• A description for a quick reference.

• A group that can be used to organize different types of exceptions. For example, you might want to have a group that counts all exception related to missing files; but because they might be generated by different parts of the application, or even different libraries, you may need to use different rules altogether to match them. Grouping here is the only convenient way to maintain the same counter for all those exceptions.

• A filename so that users know in which file the exception has been found. This is useful if you are analyzing numerous files that are stored in a single directory.

So every time I insert a new exception, the following dictionary will be appended to a list:

{ 'count' 'log_line' 'header' 'body' 'f_name' 'desc' 'group'

# counter

# log line

# header line

# body text with stack trace

# file name

# description

# group

Was this article helpful?

0 0

Post a comment