Summary:
We would like to add a few "acs_log__debug()" calls to the "db_source_sql_file" procedure in order to store the error messages of upgrade scripts in the acs_logs log table.
Why? The Problem:
During upgrades with the OpenACS APM we have repeatedly found the problem that some upgrade scripts weren't executed. We estimate that this happens during about every 2nd upgrade. However, we haven't been able to consistently reproduce this problem. This is a BIG problem for us, because the people upgrading ]po[/OpenACS are not OpenACS experts.
The Solution:
In order to gather more information about the upgrade problem we need to actually log the information. acs_logs already exists and calls to "acs_log__debug()" (PlPg/SQL)
are cheap. With this information we'll be able to reproduce
what has happened.
Why not just using the log file?
Upgrade problems are reported somethimes weeks after the upgrade has happened so that the error.log files are not there anymore.
The code:
Below is a snippet of the code from db_source_sql_file in the acs-tcl/tcl/00-database-procs.tcl file wit the two extra lines added:
catch {db_string log "SELECT acs_log__debug(:file, 'db_source_sql_file: Executing file')"} err_msg
while { [gets $fp line] >= 0 } {
# Don't bother writing out lines which are purely whitespace.
if { ![string is space $line] } {
apm_callback_and_log $callback "[ad_quotehtml $line]\n"
}
catch {db_string log "SELECT acs_log__debug(:file, coalesce(:line, ''))"} err_msg
}
This extra lines would apply to both the PostgreSQL and the Oracle part of the procedure (2 x 2 lines = 4 extra lines...)
Cheers!
Frank