Skip to content

Commit 9309841

Browse files
committed
Include response body in async call failure log
1 parent b9b56b1 commit 9309841

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

operator/src/main/java/oracle/kubernetes/operator/calls/AsyncRequestStep.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ public NextAction apply(Packet packet) {
151151
new BaseApiCallback<T>() {
152152
@Override
153153
public void onFailure(
154-
ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
154+
ApiException ae, int statusCode, Map<String, List<String>> responseHeaders) {
155155
if (didResume.compareAndSet(false, true)) {
156156
if (statusCode != CallBuilder.NOT_FOUND) {
157157
LOGGER.info(
158158
MessageKeys.ASYNC_FAILURE,
159-
e,
159+
ae.getMessage(),
160160
statusCode,
161161
responseHeaders,
162162
requestParams.call,
@@ -165,7 +165,8 @@ public void onFailure(
165165
requestParams.body,
166166
fieldSelector,
167167
labelSelector,
168-
resourceVersion);
168+
resourceVersion,
169+
ae.getResponseBody());
169170
}
170171

171172
helper.recycle(client);
@@ -176,7 +177,7 @@ public void onFailure(
176177
Component.createFor(
177178
RetryStrategy.class,
178179
r,
179-
new CallResponse<Void>(null, e, statusCode, responseHeaders)));
180+
new CallResponse<Void>(null, ae, statusCode, responseHeaders)));
180181
fiber.resume(packet);
181182
}
182183
}
@@ -233,9 +234,14 @@ public void onSuccess(
233234
timeoutSeconds,
234235
TimeUnit.SECONDS);
235236
} catch (Throwable t) {
237+
String responseBody = "";
238+
if (t instanceof ApiException) {
239+
ApiException ae = (ApiException) t;
240+
responseBody = ae.getResponseBody();
241+
}
236242
LOGGER.warning(
237243
MessageKeys.ASYNC_FAILURE,
238-
t,
244+
t.getMessage(),
239245
0,
240246
null,
241247
requestParams,
@@ -244,7 +250,8 @@ public void onSuccess(
244250
requestParams.body,
245251
fieldSelector,
246252
labelSelector,
247-
resourceVersion);
253+
resourceVersion,
254+
responseBody);
248255
if (didResume.compareAndSet(false, true)) {
249256
packet
250257
.getComponents()

operator/src/main/resources/Operator.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ WLSKO-0002=The Kuberenetes Master URL is set to {0}
44
WLSKO-0003=
55
WLSKO-0004=
66
WLSKO-0005=The Oracle WebLogic Server Operator for Kubernetes is shutting down
7-
WLSKO-0006=Exception thrown: {0}
7+
WLSKO-0006=Exception thrown
88
WLSKO-0007=Created Service: {0}
99
WLSKO-0008=Status: {0}
1010
WLSKO-0009=Created Network Policy: {0}
@@ -93,7 +93,7 @@ WLSKO-0091=External Channel {0} is using {1} protocol. For non-T3 channels use I
9393
WLSKO-0092=External Channel {0} is not defined in server {1}
9494
WLSKO-0093=External Channel {0} port {1} is outside the NodePort range starting at {2} through {3}
9595
WLSKO-0094=Async call invoking: {0}, namespace: {1}, name: {2}, body: {3}, fieldSelector: {4}, labelSelector: {5}, resourceVersion: {6}
96-
WLSKO-0095=Async call failed: {0}, code: {1}, headers {2} after invoking {3}, namespace: {4}, name: {5}, body: {6}, fieldSelector: {7}, labelSelector: {8}, resourceVersion: {9}
96+
WLSKO-0095=Async call failed: {0}, code: {1}, headers {2} after invoking {3}, namespace: {4}, name: {5}, body: {6}, fieldSelector: {7}, labelSelector: {8}, resourceVersion: {9}, response body: {10}
9797
WLSKO-0096=Async call succeeded: {0}, code: {1}, headers {2}
9898
WLSKO-0097=Async call will not be retried: {0}, code: {1}, headers {2}
9999
WLSKO-0098=Async call will be retried after delay: {0} ms

0 commit comments

Comments
 (0)