|By Andreas Grabner||
|October 5, 2014 09:00 PM EDT||
Don’t Trust Your Log Files: How and Why to Monitor All Exceptions
I would say that only one out of a million exceptions thrown in an application actually makes it to a log file - unless you run your application in verbose logging mode - Do you agree? No? Here is why I think that is: because most exceptions are handled by your code or by the frameworks your app uses. Here is a chart from an enterprise application showing that there are about 4000x more custom application exception objects thrown than important log messages written:
4000 times more Exceptions than log messages: Can they be ignored? What's their impact?
Why worry about these exceptions that nobody cares to write to a log file? Two reasons:
- They are typically thrown for a good reason and therefore indicate a problem, e.g., configuration issues in frameworks or runtime problems
- Every Exception object is a potential performance problem because it means the JVM needs to allocate memory, get the stack trace and dispose the object soon after
Reason #1: Configuration Problems
The following shows a transaction where the method getImagePath makes a web service call to a back-end server using HttpClient. getImagePath uses an HTTP Endpoint URL. The Web Service however only supports HTTPS (SSL). The web service call therefore fails with an SSLException. getImagePath retries three times until it gives up and just returns a default value to the caller. No log entry written, no exception thrown to the caller, everything seems okay to the outside world even though we have a severe impact on an end user who is waiting longer than necessary for an image that he doesn't get to see:
Exceptions are highlighting configuration problems (wrong URL) but the calling method is not doing anything with that information
- End Users: This code is executed for every user that executes this request and none of them will get the correct image path. Additionally, the user is waiting on it for several seconds. We all know what users will do if they have to wait too long.
- Business: If your app delivers dynamic user-specific content, e.g., recommendations for that user, you need to ensure that no configuration problem causes your app to deliver incorrect content. As business owner you want to get alerted when a problem in the app causes incorrect responses to your users.
- Operations: When users complain, there is no documented evidence of a problem (nothing in a log file). Make sure to monitor outgoing web requests and the status of these calls as this helps you to identify if you have requests that start failing or not delivering what they are supposed to deliver.
- Developers: Everything probably worked well when they tested this web service in their own environment where they used a dummy or mocked web service endpoint. Make sure to add log for these situations and let Operations know how to configure these endpoints.
For Reason #2, and further insight, click here for the full article.
Dec. 22, 2014 11:00 AM EST Reads: 1,469
Dec. 22, 2014 11:00 AM EST Reads: 2,360
Dec. 21, 2014 02:00 PM EST Reads: 2,444
Dec. 21, 2014 01:00 PM EST Reads: 2,043
Dec. 21, 2014 11:30 AM EST Reads: 2,449
Dec. 21, 2014 10:00 AM EST Reads: 2,199
Dec. 21, 2014 06:15 AM EST Reads: 2,172
Dec. 20, 2014 08:00 AM EST Reads: 1,457
Dec. 18, 2014 09:45 PM EST Reads: 1,305
Dec. 18, 2014 09:00 AM EST Reads: 1,425
Dec. 18, 2014 06:00 AM EST Reads: 978
Dec. 17, 2014 11:15 PM EST Reads: 1,469
Dec. 17, 2014 11:00 PM EST Reads: 1,518
Dec. 17, 2014 08:00 PM EST Reads: 1,482
Dec. 17, 2014 06:30 PM EST Reads: 1,450
Dec. 17, 2014 11:45 AM EST Reads: 1,591
Dec. 16, 2014 11:45 PM EST Reads: 1,446
Dec. 15, 2014 11:45 PM EST Reads: 1,799
Dec. 15, 2014 10:30 AM EST Reads: 6,949
Dec. 15, 2014 10:00 AM EST Reads: 2,004