Finding Hidden Exceptions in Your Application with Prefix

Matt Watson Developer Tips, Tricks & Resources

Prefix enables developers to easily see what their code is doing as they write and test their code, including SQL queries, HTTP calls, errors, logs, and much more. One of the best features of Prefix is its ability to see all of the exceptions that are occurring in your code.

There are 3 types of exceptions:

  1. Unhandled – the user got a 500 error and your app blew up 🙁
  2. Logged – your code “caught” the error and logged it somewhere
  3. Hidden – your code “caught” the error and it is never logged

Please note that, depending on if you are using .NET or Java, the functionality and potential configuration needed for errors and logs could be slightly different.

Tell the Whole Story with Integrated Logs + Errors

View Unhandled Exceptions with Prefix

Prefix will automatically show you all exceptions from a web request that abruptly ends in an exception. In this example below you can see the full stack trace and that the request ended with a 500 error.


View Logged Exceptions with Prefix

If you are using Java, Prefix will automatically show any exception that is logged to log4j or logback. For .NET, you will need to follow the directions in our docs to add the Stackify log appender to your app for log4net, Serilog, or NLog.

We highly recommend always using a common logging framework for your errors and logs. This abstracts away how you do logger from any single implementation and makes it easy to direct your log data to various targets like a file on disk or log management product like Retrace.

Viewing Hidden Exceptions with Prefix

For .NET only, Prefix is able to collect every exception that is ever thrown. In .NET these are sometimes called first chance exceptions. These are the types of exceptions that are sometimes caught deep within code bases and thrown away.

A good example of a hidden exception is this error from nopCommerce, which is a popular open source .NET ecommerce engine. It throws an exception on every page load trying to convert a value to an integer, something easily avoided with a int.TryParse().


Get the Whole Story with Errors & Logs Combined

One of the coolest features about Prefix and Retrace both is the ability to see all of your logs (and errors) for a single web request together. Logs combined with SQL queries, HTTP calls, and many other common dependencies, makes understanding what your code is doing much easier.

Example showing debug logging, exception, 2 SQL queries, and a redis call.



Prefix is free. Download it today and get started with your bug hunt!

If an exception happens and there is no code there to catch it, does it still bug you? #nerdHumor


Get Prefix Power on a server!
Get Prefix Power on a server!

About Matt Watson

Matt is the Founder & CEO of Stackify. He has been a developer/hacker for over 15 years and loves solving hard problems with code. While working in IT management he realized how much of his time was wasted trying to put out production fires without the right tools. He founded Stackify in 2012 to create an easy to use set of tools for developers.