InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


Debugging InstantDB Applications


It can sometimes be useful to be able to see what's going on inside InstantDB. This can be particularly useful when problems occur during recovery or when deadlocks occur.

The SET EXPORT is mainly used to export results sets to text files. However it can also be used to set the level of diagnostic tracing which is enabled. The syntax when used in this way is:

SET EXPORT <log file> TRACE <level>
[CONSOLE] [TIME]

Trace levels are organized as a bitmap. Setting the appropriate bit causes the associated level of tracing to be activated. The various bits are defined via the following public final ints in the db.Trace class:


  Previous Release

     Basic

     Advanced      Reference
Constant Value Bit Description
TR_EVENT 1 0 Major events such as database open and close
TR_SQL 2 1 Logs each SQL statment processed
TR_ERROR 4 2 Logs errors
TR_OPEN 8 3 Table open and close
TR_TRANS 16 4 Transaction processing and locking
TR_PROGRESS 32 5 Progress of imports and index builds
TR_CACHE 64 6 Cache activity
TR_MEM 128 7 Memory and garbage collection
TR_INDEX 256 8 Index activity
TR_PARSE 512 9 SQL parsing
TR_JDBC 1024 10 JDBC calls
TR_EXPORT 2048 11 Used internally by SET EXPORT
TR_TABLESCAN 4096 12 Table scans during SELECTs

So
SET EXPORT "fred.log" TRACE 18
would set tracing on for SQL processing and transaction processing. Note that, unlike dumping results sets, trace levels are set globally. So if any one thread sets a trace bit on, all other threads are affected. This inconsistency in the SET EXPORT command is unfortunate, but it has turned out to be necessary for performance reasons.

Including the optional CONSOLE keyword causes tracing to also be directed to standard out. The TIME keyword causes the GMT time to be output along with every trace line.

The properties traceLevel, traceFile and traceConsole determine the initial tracing which is produced (i.e. before a thread executes the SET EXPORT command).