Trojan icon indicating copy to clipboard operation
Trojan copied to clipboard

日志打印经常 报这个错误 Error read file size

Open coderAndyYe opened this issue 6 years ago • 1 comments

我看了下源码:

ErrInfo *LogWriter::checkMmapFile() { //判断是否有读写权限 if (access(filePath.c_str(), 0) != 0) { return new ErrInfo(WRITE_EXIT, "Error access log file"); } this->fileStat.st_size = 0; if (fstat(fd, &fileStat) == -1 || this->fileStat.st_size != this->fileSize) { return new ErrInfo(FSTAT_EXIT, "Error read file size"); } return NULL; }

怎么避免呢

coderAndyYe avatar Jan 02 '20 08:01 coderAndyYe

日志默认是放在data/data/包名下面的,最好放在这个目录下面,如果在SD目录下的话,容易出现问题,出现上面这个问题应该是日志文件被删除了,你得检查一下哪里把这个日志文件删除的逻辑

zhongxiaofeng avatar Feb 14 '20 07:02 zhongxiaofeng