Chapter 3. The debugger extension

With DAL you get an extension named "debugger". This extension can log the queries DAL executes on the database, including their output. So when something goes wrong with the database or some queries don't get executed as you expect them it can be handy to let DAL log the queries so you can see what happens.

Configuring the debugger extension

The debugger get's configured in the same way DAL get's configured, by a configuration object. Within the configuration object there are a few variables that can be filled in. Below you'll find a list of these variables with a description of what the variable does.

$globalFilename

This variable contains the filename of the file that is used to store the debug messages.

$globalFilePath

This variable contains the path where the log file has to be stored. Don't forget to add a trailing slash, else the file will be written at a location where you don't expect it.

$tmpFilePath

This variable contains the path which is used to store the temporary log files. Also don't forget to add a trailing slash to the path. Else you get the same unpredictable behavior as with the $globalFilePath.

$waitTime

This variable contains the time to wait between attempts to lock the output file. It is specified in seconds.

$tries

Specifies the number of tries before giving up trying to get a lock at the output file.

$dumpResult

Specifies if the result of a query should also be written to the debug log. Dumps the complete resultset when enabled.

Important

The following items are advised not to be modified.

$queryHook

Specifies if the extension should be called when queries are executed

$selectDBHook

Should the extension be called at selecting a database

$transactionHook

Should the extension be called when a transaction function is called

$final

Should the extension be final. This means that it will be executed as the last one in a chain of extensions. Only one extension can be the last one, so if you load more than one extension that is final only one of them get's called. The final attribute is advised if the extension is using the dbdriver itself and wants to report some success back.