Forum OpenACS Development: Add ad_log_stack_trace to db_transaction errors

Without the actual stack trace in a db_transaction error, debugging is impossible.

I propose adding ad_log_stack_trace into db_transaction to log the error. This doesn't change how existing error handling works, it just makes the errors easier to debug.

Any objections?

Collapse
Posted by Gustaf Neumann on
Do you mean to log the call stack in the case, where no "on_error" clause is specified, or in all cases where db_transaction runs into an error?
Collapse
Posted by Dave Bauer on
Actually, you are right, in all cases we need the stack trace, whether or not on_error is specified. When the error is caught we only see the text of the error message but we can't see the context so debugging is impossible.

Having just the error message might be useful to parse the error message to generate a meaningful error for the user, but doesn't help programmers.

Collapse
Posted by Gustaf Neumann on
i was just asking for clarity. Do we have code-pieces, where transactions fail frequently (not only in error cases)? Maybe it is a good idea to add a switch "-logging severity" (default "error") and use the severity in the ns_log command.

Btw, this could be used nicely together with the ns_log redirector i wrote long ago. The redirector allows to perform arbitrary actions depending on the severity level of ns_log. With the redirector, one can e.g. write e.g. "ns_log error ..." messages additionally into ds_comments, such you do not have to search around in the error log file.

For someone interested, i have just committed the ns_log redirector deactivated to cvs head in xotcl-core.