|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.
Sep. 25, 2016 01:00 PM EDT Reads: 804
Sep. 25, 2016 12:45 PM EDT Reads: 2,349
Sep. 25, 2016 12:15 PM EDT Reads: 1,068
Sep. 25, 2016 12:15 PM EDT Reads: 3,364
Sep. 25, 2016 11:45 AM EDT Reads: 1,631
Sep. 25, 2016 11:30 AM EDT Reads: 1,498
Sep. 25, 2016 11:00 AM EDT Reads: 1,549
Sep. 25, 2016 11:00 AM EDT Reads: 1,492
Sep. 25, 2016 10:30 AM EDT Reads: 1,693
Sep. 25, 2016 10:15 AM EDT Reads: 841
Sep. 25, 2016 10:00 AM EDT Reads: 904
Sep. 25, 2016 10:00 AM EDT Reads: 954
Sep. 25, 2016 09:45 AM EDT Reads: 1,772
Sep. 25, 2016 09:00 AM EDT Reads: 1,547
Sep. 25, 2016 08:00 AM EDT Reads: 1,492
Sep. 25, 2016 08:00 AM EDT Reads: 1,518
Sep. 25, 2016 08:00 AM EDT Reads: 1,673
Sep. 25, 2016 06:30 AM EDT Reads: 2,813
Sep. 25, 2016 05:30 AM EDT Reads: 1,010
Sep. 25, 2016 04:45 AM EDT Reads: 1,525