From 06a766de56905779fa66b94487fbfdddbe24148c Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Fri, 20 Feb 2015 10:58:29 -0800 Subject: [PATCH] Adding Flush to AutoRollLogger Summary: During running AutoRollLoggerTest on FreeBSD we have found out that AutoRollLogger is not flushing correctly (test fails on FreeBSD) This diff add Flush to AutoRollLogger to fix this problem Test Plan: [My machine] make all check ( all tests pass) [FreeBSD VM] running AutoRollLoggerTest ( all tests pass ) Reviewers: sdong, igor Reviewed By: igor Subscribers: dhruba Differential Revision: https://reviews.facebook.net/D33633 --- util/auto_roll_logger.h | 6 ++++++ util/auto_roll_logger_test.cc | 1 + 2 files changed, 7 insertions(+) diff --git a/util/auto_roll_logger.h b/util/auto_roll_logger.h index 486a1eae3b..ff995f0e0a 100644 --- a/util/auto_roll_logger.h +++ b/util/auto_roll_logger.h @@ -56,6 +56,12 @@ class AutoRollLogger : public Logger { return logger_->GetLogFileSize(); } + void Flush() { + if (logger_) { + logger_->Flush(); + } + } + virtual ~AutoRollLogger() { } diff --git a/util/auto_roll_logger_test.cc b/util/auto_roll_logger_test.cc index 7f75edf991..117ecd46b5 100755 --- a/util/auto_roll_logger_test.cc +++ b/util/auto_roll_logger_test.cc @@ -308,6 +308,7 @@ TEST(AutoRollLoggerTest, LogHeaderTest) { Info(&logger, (kSampleMessage + ":LogHeaderTest line %d").c_str(), i); ++i; } + LogFlush(&logger); // verify that the new log contains all the header logs std::stringstream ssbuf;