Skip to content

Commit a1bb4cc

Browse files
committed
Change payload exposition level from "debug" to "trace"
1 parent 1b0dc0e commit a1bb4cc

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

core/src/main/java/com/sap/ai/sdk/core/AiCoreServiceKeyAccessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public List<ServiceBinding> getServiceBindings() throws ServiceBindingAccessExce
5050
log.debug("No service key found in environment variable {}", ENV_VAR_KEY);
5151
return List.of();
5252
}
53-
log.info(
53+
log.debug(
5454
"""
5555
Found a service key in environment variable {}.
5656
Using a service key is recommended for local testing only.

core/src/main/java/com/sap/ai/sdk/core/common/ClientResponseHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ private T parseResponse(@Nonnull final ClassicHttpResponse response) throws E {
7878
throw exceptionConstructor.apply("Response was empty.", null);
7979
}
8080
val content = getContent(responseEntity);
81-
log.debug("Deserializing JSON response to type {}: {}", responseType.getSimpleName(), content);
81+
log.trace("Deserializing JSON response to type {}: {}", responseType.getSimpleName(), content);
8282
try {
8383
return objectMapper.readValue(content, responseType);
8484
} catch (final JsonProcessingException e) {
85-
log.error("Failed to deserialize the response to type: {}", responseType.getSimpleName(), e);
85+
log.debug("Failed to deserialize the response to type: {}", responseType.getSimpleName());
8686
throw exceptionConstructor.apply("Failed to parse response", e);
8787
}
8888
}
@@ -123,7 +123,7 @@ public void buildExceptionAndThrow(@Nonnull final ClassicHttpResponse response)
123123
}
124124

125125
log.error("The service responded with HTTP error code {}", errorCode);
126-
log.debug("The service responded with HTTP error code {} and content: {}", errorCode, content);
126+
log.trace("The service responded with HTTP error code {} and content: {}", errorCode, content);
127127
val contentType = ContentType.parse(entity.getContentType());
128128
if (!ContentType.APPLICATION_JSON.isSameMimeType(contentType)) {
129129
throw exception;

core/src/main/java/com/sap/ai/sdk/core/common/ClientStreamingHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ public Stream<D> handleStreamingResponse(@Nonnull final ClassicHttpResponse resp
7676
final String data = line.substring(5); // remove "data: "
7777
try {
7878
return objectMapper.readValue(data, responseType);
79-
} catch (final IOException e) { // exception message e gets lost
80-
log.error("Failed to parse thr streamed response.");
81-
log.debug("Failed to parse the following response: {}", line, e);
82-
throw exceptionConstructor.apply("Failed to parse delta message: " + line, e);
79+
} catch (final IOException e) {
80+
final String message = e.getMessage();
81+
log.error("Failed to parse the streamed response: " + message);
82+
log.trace("Failed to parse the following response: {}", line);
83+
throw exceptionConstructor.apply("Failed to parse delta message: " + message, e);
8384
}
8485
});
8586
}

orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationHttpExecutor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <T> T execute(
4040
@Nonnull final Class<T> responseType) {
4141
try {
4242
val json = JACKSON.writeValueAsString(payload);
43-
log.debug("Serialized request into JSON payload: {}", json);
43+
log.trace("Serialized request into JSON payload: {}", json);
4444
val request = new HttpPost(path);
4545
request.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
4646

0 commit comments

Comments
 (0)