提交 b051f6b0 编写于 作者: wu-sheng's avatar wu-sheng 提交者: Jared Tan

Log message cached unexpected (#3303)

上级 a71c3abe
......@@ -65,14 +65,18 @@ public class FileWriter implements IWriter {
.newSingleThreadScheduledExecutor(new DefaultNamedThreadFactory("LogFileWriter"))
.scheduleAtFixedRate(new RunnableWithExceptionProtection(new Runnable() {
@Override public void run() {
logBuffer.drainTo(outputLogs);
for (String log : outputLogs) {
writeToFile(log + Constants.LINE_SEPARATOR);
}
try {
fileOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
logBuffer.drainTo(outputLogs);
for (String log : outputLogs) {
writeToFile(log + Constants.LINE_SEPARATOR);
}
try {
fileOutputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
} finally {
outputLogs.clear();
}
}
}, new RunnableWithExceptionProtection.CallbackWhenException() {
......@@ -165,8 +169,7 @@ public class FileWriter implements IWriter {
}
/**
* Write log to the queue.
* W/ performance trade off, set 2ms timeout for the log OP.
* Write log to the queue. W/ performance trade off, set 2ms timeout for the log OP.
*
* @param message to log
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册