diff --git a/include/plog/Appenders/RollingFileAppender.h b/include/plog/Appenders/RollingFileAppender.h index 3b66728..5d1a6ed 100644 --- a/include/plog/Appenders/RollingFileAppender.h +++ b/include/plog/Appenders/RollingFileAppender.h @@ -35,6 +35,8 @@ namespace plog virtual void write(const Record& record) PLOG_OVERRIDE { + const std::string& line = Converter::convert(Formatter::format(record)); + util::MutexLock lock(m_mutex); if (m_firstWrite) @@ -47,7 +49,7 @@ namespace plog rollLogFiles(); } - size_t bytesWritten = m_file.write(Converter::convert(Formatter::format(record))); + size_t bytesWritten = m_file.write(line); if (static_cast(-1) != bytesWritten) {