diff --git a/services/hilogd/log_persister_rotator.cpp b/services/hilogd/log_persister_rotator.cpp index 1be6d5ab339e26e277441584abdb75412d741b77..c8277e915c7a91f29d8a854f259779abeae2a730 100644 --- a/services/hilogd/log_persister_rotator.cpp +++ b/services/hilogd/log_persister_rotator.cpp @@ -86,7 +86,7 @@ void LogPersisterRotator::InternalRotate() cout << "OLD NAME " << oldName << " NEW NAME " << newName << endl; rename(oldName.c_str(), newName.c_str()); } - output.open(ss.str(), ios::out); + output.open(ss.str(), ios::trunc); } void LogPersisterRotator::Rotate() @@ -99,7 +99,7 @@ void LogPersisterRotator::Rotate() stringstream ss; ss << fileName << "." << index << fileSuffix; cout << "THE FILE NAME !!!!!!! " << ss.str() << endl; - output.open(ss.str(), ios::app); + output.open(ss.str(), ios::trunc); } fseek(fdinfo, 0, SEEK_SET); fwrite(&index, sizeof(uint8_t), 1, fdinfo);