Skip to content

Commit 91961ad

Browse files
committed
add comments to OutputStreamAppender
Signed-off-by: Ceki Gulcu <[email protected]>
1 parent 6d11eff commit 91961ad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void stop() {
136136
protected void closeOutputStream() {
137137
if (this.outputStream != null) {
138138
try {
139-
// before closing we have to output out layout's footer
139+
// before closing we have to output out encooder's footer
140140
encoderClose();
141141
this.outputStream.close();
142142
this.outputStream = null;
@@ -204,6 +204,8 @@ private void writeBytes(byte[] byteArray) throws IOException {
204204
streamWriteLock.lock();
205205

206206
try {
207+
// guard against appender having been stop() in parallel
208+
// note that the encoding step is performed outside the protection of the streamWriteLock
207209
if(isStarted()) {
208210
writeByteArrayToOutputStreamWithPossibleFlush(byteArray);
209211
updateByteCount(byteArray);

0 commit comments

Comments
 (0)