Skip to content

Commit 449b53c

Browse files
committed
modified loglevels in case of ssl and non-ssl execute()
1 parent 3dc2866 commit 449b53c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/com/databricks/jdbc/client/http/DatabricksHttpClient.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,10 @@ private CloseableHttpClient makeClosableDisabledSslHttpClient() {
163163
.setSSLHostnameVerifier(new NoopHostnameVerifier())
164164
.build();
165165
} catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
166-
System.out.println("Error in creating HttpClient with the SSL context");
166+
LoggingUtil.log(
167+
LogLevel.DEBUG,
168+
String.format(
169+
"Error in creating HttpClient with the SSL context [{%s}]", e.getMessage()));
167170
}
168171
return null;
169172
}
@@ -347,7 +350,7 @@ public CloseableHttpResponse execute(HttpUriRequest request) throws DatabricksHt
347350
try {
348351
return httpClient.execute(request);
349352
} catch (IOException e) {
350-
throwHttpException(e, request);
353+
throwHttpException(e, request, LogLevel.ERROR);
351354
}
352355
return null;
353356
}
@@ -360,7 +363,7 @@ public CloseableHttpResponse executeWithoutSSL(HttpUriRequest request)
360363
try {
361364
return httpDisabledSSLClient.execute(request);
362365
} catch (Exception e) {
363-
throwHttpException(e, request);
366+
throwHttpException(e, request, LogLevel.DEBUG);
364367
}
365368
return null;
366369
}
@@ -413,7 +416,7 @@ public static synchronized void removeInstance(IDatabricksConnectionContext cont
413416
}
414417
}
415418

416-
private static void throwHttpException(Exception e, HttpUriRequest request)
419+
private static void throwHttpException(Exception e, HttpUriRequest request, LogLevel logLevel)
417420
throws DatabricksHttpException {
418421
Throwable cause = e;
419422
while (cause != null) {
@@ -426,7 +429,7 @@ private static void throwHttpException(Exception e, HttpUriRequest request)
426429
String.format(
427430
"Caught error while executing http request: [%s]. Error Message: [%s]",
428431
RequestSanitizer.sanitizeRequest(request), e);
429-
LoggingUtil.log(LogLevel.ERROR, errorMsg);
432+
LoggingUtil.log(logLevel, errorMsg);
430433
throw new DatabricksHttpException(errorMsg, e);
431434
}
432435
}

0 commit comments

Comments
 (0)