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:
- Unhandled – the user got a 500 error and your app blew up 🙁
- Logged – your code “caught” the error and logged it somewhere
- 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.
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
- How to Use Web.Config customErrors for ASP.NET - April 26, 2017
- Best Practices for Error Handling in ASP.NET MVC - April 25, 2017
- What is NullReferenceException? Object reference not set to an instance of an object - April 17, 2017
- Understanding # of Exceps Thrown / Sec, and How to Find Exceptions - April 17, 2017
- How to Generate C# Random Numbers, Pseudo vs Secure Random Numbers - April 16, 2017