Forum OpenACS Development: Re: ways to insert and update db

Collapse
Posted by Tom Jackson on
Is it possible to provide more information on what you are trying to do? Are you considering modifying the db_* API? If so, it is better to speak up now, as it would affect everyone. Otherwise, you do know that every database type uses ns_db and the database module to communicate, right? Therefore, the logging I suggested would cover every database type.

But I haven't seen a statement of the issue yet which lends itself to providing all the information you want. Even the db_* API is necessarily removed from users/connections, and generally it is difficult to separate API calls via package, since one goal is to reuse code. The best single place to figure out all this is the server.log file. Most versions of AOLserver print the thread id and/or the thread name with each log statement. It should be possible to either add a log statement at the beginning of each request you want to log, or for every request and then parse the file to look for specific information. It does take up more disk space, and might be a little slower to log everything, but it is more generic and easier to adapt to future needs. For instance, you can look back to a previous day to figure out what was going on. If you target your logging, you are likely to limit it in arbitrary ways. And if you don't want to use it, it is easy to turn off.

One change I could see making life easier would be to use separate database pools for scheduled procs as opposed to connection threads, the scheduled procs are easy to track.