pl/sql code instrumentation

Babo

Member³
I'm need to use extensive loging mechanism. I'm thinking about debugf ( tom kyte) and LOG4PLSQL.
Does PLD has smth like this ?
 
You can try the logging and dynamic debugging features found in PL/SQL Starter Framework (found on Sourceforge).

I'd like to know better what you mean by "extensive", then some of us could help point you in the best direction.
 
We use a custom instrumentation package where I work. It takes a fair amount of time to instrument a package even using templates.

What would be kind of cool, I think, is if PL/SQL developer had a way to automatically mark the package with instrumentation code using a tool. If it used templates and/or variables somehow, it could be flexible and it could mark up whenever a variable was assigned, when a procedure was entered/exited, the parameters and stuff. Perhaps have a few included templates for popular instrumentation packages like log4plsql and debugf, but still have the option to create our own. Variables used in the templates could include package name, procedure/function name, variable name etc.
 
Another option I thought of is if it could have an option to only do this when when compiling. Some like to have it instrumented in development instances, but not in production. If it made a copy of the code, instrumented it, and compiled that, the source code would still not be instrumented and could move on to production. (Kind of like a twist to the safe compile option).
 
Thank you Mark,
I recommend ( @ work ) the use of LOG4PL/SQL library. You may want to take a look.
the idea of having (semi) automatic way of doing is awesome. i'm for it.
 
Although log4plsql has been around a while and provides lots of output options, I found it overblown, and the last time I looked, not terribly well maintained.

The instrumentation features of the open source PL/SQL Starter Framework make it very easy to use and dynamic.

By easy to use, I mean it's no harder than taking your existing comments and wrapping them in a logs.dbg('message here') call. There are also the info(), warn(), and err() options, but I primarily use dbg().

The framework handles the rest (whether the output is ignored (debugging is toggled off), whether the output goes to file, the screen or a logging table, and all the metadata about the call, like which package, routine, line number, client identifier, IP address, etc.).

By dynamic, I mean what Mike was hoping for. It is table-driven. Although you can override it for unit tests, the debug output is toggled off by default. To turn it on, one simply alters a column value in the framework core schema, either turning debugging on entirely, or for a given session, or given user, or given PL/SQL unit or list of units. This is invaluable when a user kicks off a report, or backend process in production, then calls support asking why it's taking longer than normal.

Yes, I'm the author, but I've been doing this for 15 years now, and this is the easiest-to-use instrumentation I've ever worked with. The framework does take a little time to set up, but once that's invested, all your future apps can start benefiting from it.
 
@ bcoulam: i didn't know about this project. thank you! I'll take a look.

@Marco : did i read it right that you added some instrumentation framework into 9 ?
 
Back
Top