When developing software application, why code instrumentation/tracing/logging must be done?
Easy to maintain
Tells where the problem is when something goes wrong, where to look for. Helps troubleshooting and fix bugs.
It's often difficult to track down the source of an error without some form of debugging instrumentation. This is particularly true in multi-tier, stateless architectures, running on production system.
There will be lot’s of restrictions to reproduce the bugs and errors on production system, most time it’ll corrupt the production data.
To make application traceable.
Traceability, auditing and logging are crucial.
“In transaction processing software, traceability implies use of a unique piece of data (e.g., order date/time or a serialized sequence number) which can be traced through the entire software flow of all relevant application programs. Messages and files at any point in the system can then be audited for correctness and completeness, using the traceability key to find the particular transaction.”
To get runtime status and stats.
To know what’s going on in real time on production system.
To measure performance. Profile.
Tells the application transaction response time and transaction volume (throughput).
“End users want to know, is the system going slower over time, if so, by how much. Management wants to know, what are my transaction response times, how many transactions do we do, when is the busiest time, and so on. People responsible to administering the system need to be able to identify where bottlenecks are, who needs to be brought in to look at something, who is responsible.”
To make the code runs faster.
The overhead of instrumentation is approximately -27%
Yes, NEGATIVE 27%.
Evidence that is true:
a) oracle is heavily instrumented (v$ tables, sql_trace, AWR, ASH, statspack, etc etc etc)
b) without that instrumentation - you would not know where to begin to start to tune
c) therefore, we run faster with it than without it - much much faster...
Good engineer practice.
The logging should be able to be turned ON and OFF easily - just like sql_trace.
That’s why we migrated to logger from debugf. It's easy to "turn-off" logger globally with virtually no performance impact, it's easy to get in the habit of leaving debug calls in production code.
The instrumentation should always be there, it should always be infinitely detailed.
but most of the time, it shouldn't be executed. Common sense must prevail.
Logger is used by Oracle developers to instrument their PL/SQL code