The easiest way is to create your own db profiler. e.g. The configuration for using the firebug+firephp profiler in an ini configuration file will look something like this:
resources.db.params.dbname = "dbname"
resources.db.params.username = "username"
resources.db.params.password = "password"
resources.db.params.profiler.enabled = 1
resources.db.params.profiler.class = "Zend_Db_Profiler_Firebug"
If we take a look at the Zend_Db_Profiler_Firebug it's really quite a simple piece of code, it extends Zend_Db_Profiler overriding some methods to implement the firebug+firephp logging logic.
So we can create our own custom logging profiler by extending Zend_Db_Profiler. e.g. Our custom profiler might be contained in a custom library: CustomLib_Db_Profiler:
CustomLib_Db_Profile extends Zend_Db_Profiler
{
// log db profiling to file logic ...
}
Now all we need to do to turn on our custom logging routine is change Zend_Db_Profiler_Firebug to CustomLib_Db_Profiler in our configuration file, like so (of course, this assumes the CustomLib prefix, in this example, in on the include path):
resources.db.params.dbname = "dbname"
resources.db.params.username = "username"
resources.db.params.password = "password"
resources.db.params.profiler.enabled = 1
resources.db.params.profiler.class = "CustomLib_Db_Profiler"