Added option to turn of database logging to log file
Added in missing code for database logging