Added local log file and better DB logging