Logging tweaks, small fixes and support for multiple SQL databases (771)