improved logging to file