|
@@ -622,24 +622,27 @@ void CGUIConsoleEntity::InitializeBeidou()
|
|
|
void CGUIConsoleEntity::OnTimeout(DWORD dwTimerID)
|
|
|
{
|
|
|
static long oldFileSize = -1;
|
|
|
+ const long maxFileSize = 10000000; //10MB
|
|
|
const char* defaultDBStoragePath = "/opt/rvc/terminaldbstorage/RVC.LogSdk/RvcLogSdk.db";
|
|
|
|
|
|
if (dwTimerID == ENT_TIMERID_CHECK_LOGDB_SIZE) {
|
|
|
if (ExistsFileA(defaultDBStoragePath)) {
|
|
|
struct stat statbuf;
|
|
|
- if (stat(defaultDBStoragePath, &statbuf)) {
|
|
|
+ if (stat(defaultDBStoragePath, &statbuf) < 0) {
|
|
|
int err = errno;
|
|
|
- LogWarn(Severity_Middle, Error_Resource, EVENT_MOD_GUICONSOLE_UNIONNETLOG_LOCAL_STORAGE_SIZE,
|
|
|
+ LogWarn(Severity_Low, Error_Resource, EVENT_MOD_GUICONSOLE_UNIONNETLOG_LOCAL_STORAGE_SIZE,
|
|
|
CSimpleStringA::Format("failed to stat %s: %s", defaultDBStoragePath, strerror(err)));
|
|
|
} else {
|
|
|
if (oldFileSize != statbuf.st_size) {
|
|
|
- LogWarn(Severity_Middle, Error_Resource, EVENT_MOD_GUICONSOLE_UNIONNETLOG_LOCAL_STORAGE_SIZE,
|
|
|
- CSimpleStringA::Format("db file changed from: %d to %ld", oldFileSize, statbuf.st_size));
|
|
|
- oldFileSize = statbuf.st_size;
|
|
|
+ if (statbuf.st_size >= maxFileSize) {
|
|
|
+ LogWarn(Severity_Low, Error_Resource, EVENT_MOD_GUICONSOLE_UNIONNETLOG_LOCAL_STORAGE_SIZE,
|
|
|
+ CSimpleStringA::Format("db file changed from: %d to %ld", oldFileSize, statbuf.st_size));
|
|
|
+ }
|
|
|
+ oldFileSize = statbuf.st_size;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- LogWarn(Severity_Middle, Error_Resource, EVENT_MOD_GUICONSOLE_UNIONNETLOG_LOCAL_STORAGE_SIZE,
|
|
|
+ LogWarn(Severity_Low, Error_Resource, EVENT_MOD_GUICONSOLE_UNIONNETLOG_LOCAL_STORAGE_SIZE,
|
|
|
CSimpleStringA::Format("%s does not exist!", defaultDBStoragePath));
|
|
|
}
|
|
|
}
|