Fix log.error & Improve file error handle