Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
coderAndyYe opened this issue Jan 2, 2020 · 1 comment
Open

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

coderAndyYe opened this issue Jan 2, 2020 · 1 comment

Comments

@coderAndyYe
Copy link

我看了下源码:

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;
}

怎么避免呢

@zhongxiaofeng
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants