Databases Reference
In-Depth Information
C H A P T E R 6
Debugging
by Doug Gault
At some point during the process of writing or maintaining an APEX application you will need to step
into the world of debugging. APEX 4 has quite extensively enhanced debugging capabilities compared to
its predecessors. This chapter will introduce you to the nuances and esoterics of debugging in APEX.
While a certain amount of knowledge regarding debugging is assumed, the debugging mechanisms
available in APEX 4 are different enough to merit a full ground-up discussion.
Note This chapter specifically addresses the tools that APEX 4 provides for debugging and does not discuss
external or third-party tools.
Principles of Code Instrumentation
While it may seem odd to start off a chapter on APEX Debugging with a discussion about what makes
good code instrumentation, it's actually very important. In any development environment, the ability to
quickly and easily see what your program is doing during execution is a critical component of
debugging—especially when using a framework like APEX where a large portion of the core code is
beyond your capacity to change.
Proper code instrumentation has a set of precepts that should be followed. They include the
following:
Exists in every environment : Code instrumentation should be available in all environments, from
Development to Production. Inserting instrumentation code in a development environment and
then removing it again before migrating to production not only takes away your ability to diagnose
issues in production, but also changes the core code, potentially introducing changes in
functionality.
Easy to enable and disable : The instrumentation should be easy for the programmer (and in certain
cases, for the user) to enable and disable. Often code instrumentation is disabled by default and
only turned on when there is a problem to diagnose.
Always on : You should not need to re-compile any code to turn on instrumentation. This is
especially important in a Production environment where on-the-fly code changes are often locked
down very tightly. Instead, instrumentation should be enabled via a parameter or by adding a value
to a table.
Search WWH ::




Custom Search