Added logging to database.