implemented logging to file.