Home > Articles

Debugging Applications

📄 Contents

  1. Introduction to Debugging Techniques
  2. Debugging
  3. Assertion
  4. Tracing
  5. Logging
  6. Summary
  7. Q&A
  • Print
  • + Share This
This chapter is from the book

In yesterday's session you learned how to integrate the different parts of the MVC application you have built during the past three weeks. Also, you learned how to deploy the three layers of the MVC application: controller, view, and model.

Today you will study debugging applications, an area that will surely be of help to you. You will cover the four different techniques involved: debugging, assertion, tracing, and logging. After this you will learn about the support provided by WebLogic Server for logging. Finally, you will touch on the new logger API that is available with the JDK 1.4.

Introduction to Debugging Techniques

The development process is replete with areas where tools can be used. The need to debug applications is an inherent part of the development process. From the point at which a piece of code is written and executed, developers need to verify that the application does what it is supposed to do. This is where debugging techniques come in. Debugging techniques help developers trace the flow of execution of the application and the intermediate state of the application.

Techniques for understanding the flow of execution are not limited to developing an application. These techniques are equally relevant when an application is deployed. Consider a scenario where customers using your application are facing problems. Because the application is at your customer's site, you cannot use your development tools to solve the problems. What do you do? The next best option is to re-create the problem in your development environment, find the problem, and fix it. The only hitch is that you do not know what your customers were doing when the problem occurred. Software applications behave differently in different scenarios and errors may or may not occur consistently for all scenarios. Wouldn't it be helpful if your application could record which steps are being executed so that you could accurately re-create the conditions under which the errors occurred?

From the preceding example, there are three primary techniques that can be used:

  • Debugging—Debugging means to determine the flow of execution in an application.

  • Assertion—Assertion involves use of conditional checkpoints in an application. The checkpoints determine whether an application is executing properly, based on the state of the conditional checkpoints.

  • Tracing—Simply put, tracing is identifying the trail of the application. Tracing is performed either during development or when an application is installed and running at a deployed site.

  • Logging—Logging is essentially recording the activity of the application. Logging can be performed either during development or at a deployed site.

Even though all of these techniques seem similar and intertwined, there are certain areas where you would favor one technique or another. Take a look at these techniques to understand them better.

  • + Share This
  • 🔖 Save To Your Account