Proper logging to file