dongeforever commented on code in PR #4590:
URL: https://github.com/apache/rocketmq/pull/4590#discussion_r923058797
##########
logging/src/main/java/org/apache/rocketmq/logging/inner/LoggingBuilder.java:
##########
@@ -708,17 +708,30 @@ public synchronized void setFile(String fileName, boolean
append, boolean buffer
throw ex;
}
}
- Writer fw = createWriter(ostream);
- if (bufferedIO) {
- fw = new BufferedWriter(fw, bufferSize);
+ Writer fw = null;
+ try {
+ fw = createWriter(ostream);
+ if (bufferedIO) {
+ fw = new BufferedWriter(fw, bufferSize);
+ }
+ this.setQWForFiles(fw);
+ this.fileName = fileName;
+ this.fileAppend = append;
+ this.bufferedIO = bufferedIO;
+ this.bufferSize = bufferSize;
+ writeHeader();
+ SysLogger.debug("setFile ended");
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ if (ostream != null) {
+ ostream.close();
+ }
+ if (fw != null) {
Review Comment:
The osstream and fw is referenced by the qwWriter, which will be released
via coseFile().
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]