@@ -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