The majority of the log entries contain only one line. So my approach in detecting exception log entries is this:
• Ignore all one-line entries. These are most likely to be from the application and will not have a stack trace because it is simply not possible to put a full stack trace into one line.
• All log entries that have multiple lines are considered to contain an exception stack trace.
• An exception stack trace log entry must contain the words java and exception in the log text body.
The reason for having this two-phase detection is that a simple check like "does it have more than one line?" is very inexpensive and can eliminate a significant number of log entries.
Was this article helpful?