You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2026/10/13 13:59:02 UTC
(cxf) branch main updated: Improve logging in case of forceable stream closure (#3557)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/main by this push:
new 1933b4b6640 Improve logging in case of forceable stream closure (#3557)
1933b4b6640 is described below
commit 1933b4b6640066f06ca4f20ffa91e9aac39221f1
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Tue Oct 13 09:58:55 2026 -0400
Improve logging in case of forceable stream closure (#3557)
---
.../java/org/apache/cxf/ext/logging/LoggingOutputStream.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutputStream.java b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutputStream.java
index ab3a3b072fb..08ba5a05b3f 100644
--- a/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutputStream.java
+++ b/rt/features/logging/src/main/java/org/apache/cxf/ext/logging/LoggingOutputStream.java
@@ -22,10 +22,14 @@ package org.apache.cxf.ext.logging;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.Logger;
+import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.io.CacheAndWriteOutputStream;
public class LoggingOutputStream extends CacheAndWriteOutputStream {
+ private static final Logger LOG = LogUtils.getL7dLogger(LoggingOutputStream.class);
+
private boolean skipFlushingFlowThroughStream;
private final AtomicBoolean closed = new AtomicBoolean();
@@ -90,7 +94,7 @@ public class LoggingOutputStream extends CacheAndWriteOutputStream {
@Override
public void write(byte[] b) throws IOException {
if (closed.get()) {
- throw new IOException("The channel has been closed already");
+ throw new IOException("The output stream has been closed already");
}
try {
super.write(b);
@@ -103,7 +107,7 @@ public class LoggingOutputStream extends CacheAndWriteOutputStream {
@Override
public void write(byte[] b, int off, int len) throws IOException {
if (closed.get()) {
- throw new IOException("The channel has been closed already");
+ throw new IOException("The output stream has been closed already");
}
try {
super.write(b, off, len);
@@ -116,7 +120,7 @@ public class LoggingOutputStream extends CacheAndWriteOutputStream {
@Override
public void write(int b) throws IOException {
if (closed.get()) {
- throw new IOException("The channel has been closed already");
+ throw new IOException("The output stream has been closed already");
}
try {
super.write(b);
@@ -139,6 +143,7 @@ public class LoggingOutputStream extends CacheAndWriteOutputStream {
// Close this CachedOutputStream
// Write method maybe called more than one time... but we already consume the stream the first time
// So additional call to this.close would produce nothing
+ LOG.warning("Closing the output stream due to unrecoverable exception (while performing write operation)");
this.close();
} catch (Exception suppressed) {
if (ex != null) {