Don't truncate logs after rotation.
This commit is contained in:
parent
8c694cd3d3
commit
e11804b5b0
@ -38,7 +38,7 @@ Status AsyncFileLog::init(string path, int64 rotate_threshold, bool redirect_std
|
||||
auto after_rotation = [&] {
|
||||
ScopedDisableLog disable_log; // to ensure that nothing will be printed to the closed log
|
||||
fd.close();
|
||||
auto r_fd = FileFd::open(path, FileFd::Create | FileFd::Truncate | FileFd::Write);
|
||||
auto r_fd = FileFd::open(path, FileFd::Create | FileFd::Write | FileFd::Append);
|
||||
if (r_fd.is_error()) {
|
||||
process_fatal_error(PSLICE() << r_fd.error() << " in " << __FILE__ << " at " << __LINE__ << '\n');
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void FileLog::do_after_rotation() {
|
||||
ScopedDisableLog disable_log; // to ensure that nothing will be printed to the closed log
|
||||
CHECK(!path_.empty());
|
||||
fd_.close();
|
||||
auto r_fd = FileFd::open(path_, FileFd::Create | FileFd::Truncate | FileFd::Write);
|
||||
auto r_fd = FileFd::open(path_, FileFd::Create | FileFd::Write | FileFd::Append);
|
||||
if (r_fd.is_error()) {
|
||||
process_fatal_error(PSLICE() << r_fd.error() << " in " << __FILE__ << " at " << __LINE__ << '\n');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user