@@ -36,7 +36,7 @@ class AadInstanceDiscoveryProvider {
3636 static final TreeSet <String > TRUSTED_HOSTS_SET = new TreeSet <>(String .CASE_INSENSITIVE_ORDER );
3737 static final TreeSet <String > TRUSTED_SOVEREIGN_HOSTS_SET = new TreeSet <>(String .CASE_INSENSITIVE_ORDER );
3838
39- private static final Logger log = LoggerFactory .getLogger (AadInstanceDiscoveryProvider .class );
39+ private static final Logger LOG = LoggerFactory .getLogger (AadInstanceDiscoveryProvider .class );
4040
4141 //flag to check if instance discovery has failed
4242 private static boolean instanceDiscoveryFailed = false ;
@@ -67,7 +67,7 @@ static InstanceDiscoveryMetadataEntry getMetadataEntry(URL authorityUrl,
6767 //If instanceDiscovery flag set to false OR this is a managed identity scenario, cache a basic instance metadata entry to skip this and future lookups
6868 if (msalRequest .application () instanceof ManagedIdentityApplication || !((AbstractClientApplicationBase ) msalRequest .application ()).instanceDiscovery ()) {
6969 if (cache .get (host ) == null ) {
70- log .debug ("Instance discovery set to false, caching a default entry." );
70+ LOG .debug ("Instance discovery set to false, caching a default entry." );
7171 cacheInstanceDiscoveryMetadata (host );
7272 }
7373 return cache .get (host );
@@ -80,10 +80,10 @@ static InstanceDiscoveryMetadataEntry getMetadataEntry(URL authorityUrl,
8080
8181 //If there is no cached instance metadata, do instance discovery cache the result
8282 if (cache .get (host ) == null ) {
83- log .debug ("No cached instance metadata, will attempt instance discovery." );
83+ LOG .debug ("No cached instance metadata, will attempt instance discovery." );
8484
8585 if (shouldUseRegionalEndpoint (msalRequest )) {
86- log .debug ("Region API used, will attempt to discover Azure region." );
86+ LOG .debug ("Region API used, will attempt to discover Azure region." );
8787
8888 //Server side telemetry requires the result from region discovery when any part of the region API is used
8989 String detectedRegion = discoverRegion (msalRequest , serviceBundle );
@@ -93,7 +93,7 @@ static InstanceDiscoveryMetadataEntry getMetadataEntry(URL authorityUrl,
9393 if (((AbstractClientApplicationBase ) msalRequest .application ()).azureRegion () == null
9494 && ((AbstractClientApplicationBase ) msalRequest .application ()).autoDetectRegion ()
9595 && detectedRegion != null ) {
96- log .debug ("Region autodetection found {}, this region will be used for future calls." , detectedRegion );
96+ LOG .debug ("Region autodetection found {}, this region will be used for future calls." , detectedRegion );
9797
9898 ((AbstractClientApplicationBase ) msalRequest .application ()).azureRegion = detectedRegion ;
9999 host = getRegionalizedHost (authorityUrl .getHost (), ((AbstractClientApplicationBase ) msalRequest .application ()).azureRegion ());
@@ -160,7 +160,7 @@ private static boolean shouldUseRegionalEndpoint(MsalRequest msalRequest){
160160 } else {
161161 //Avoid unnecessary warnings when looking for cached tokens by checking if request was a silent call
162162 if (msalRequest .getClass () != SilentRequest .class ) {
163- log .warn ("Regional endpoints are only available for client credential flow, request will fall back to using the global endpoint. See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions" );
163+ LOG .warn ("Regional endpoints are only available for client credential flow, request will fall back to using the global endpoint. See here for more information about supported scenarios: https://aka.ms/msal4j-azure-regions" );
164164 }
165165 return false ;
166166 }
@@ -241,7 +241,7 @@ static AadInstanceDiscoveryResponse sendInstanceDiscoveryRequest(URL authorityUr
241241 throw MsalServiceExceptionFactory .fromHttpResponse (httpResponse );
242242 }
243243 // instance discovery failed due to reasons other than an invalid authority, do not perform instance discovery again in this environment.
244- log .debug ("Instance discovery failed due to an unknown error, no more instance discovery attempts will be made." );
244+ LOG .debug ("Instance discovery failed due to an unknown error, no more instance discovery attempts will be made." );
245245 cacheInstanceDiscoveryMetadata (authorityUrl .getHost ());
246246 }
247247
@@ -293,7 +293,7 @@ static String discoverRegion(MsalRequest msalRequest, ServiceBundle serviceBundl
293293
294294 //Check if the REGION_NAME environment variable has a value for the region
295295 if (System .getenv (REGION_NAME ) != null ) {
296- log .info ("Region found in environment variable: {}" , System .getenv (REGION_NAME ));
296+ LOG .info ("Region found in environment variable: {}" , System .getenv (REGION_NAME ));
297297 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_ENV_VARIABLE .telemetryValue );
298298
299299 return System .getenv (REGION_NAME );
@@ -307,23 +307,23 @@ static String discoverRegion(MsalRequest msalRequest, ServiceBundle serviceBundl
307307 Future <IHttpResponse > future = executor .submit (() -> executeRequest (IMDS_ENDPOINT , headers , msalRequest , serviceBundle ));
308308
309309 try {
310- log .info ("Starting call to IMDS endpoint." );
310+ LOG .info ("Starting call to IMDS endpoint." );
311311 IHttpResponse httpResponse = future .get (IMDS_TIMEOUT , IMDS_TIMEOUT_UNIT );
312312 //If call to IMDS endpoint was successful, return region from response body
313313 if (httpResponse .statusCode () == HttpStatus .HTTP_OK && !httpResponse .body ().isEmpty ()) {
314- log .info ("Region retrieved from IMDS endpoint: {}" , httpResponse .body ());
314+ LOG .info ("Region retrieved from IMDS endpoint: {}" , httpResponse .body ());
315315 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_IMDS .telemetryValue );
316316
317317 return httpResponse .body ();
318318 }
319- log .warn ("Call to local IMDS failed with status code: {}, or response was empty" , httpResponse .statusCode ());
319+ LOG .warn ("Call to local IMDS failed with status code: {}, or response was empty" , httpResponse .statusCode ());
320320 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_FAILED_AUTODETECT .telemetryValue );
321321 } catch (Exception ex ) {
322322 // handle other exceptions
323323 //IMDS call failed, cannot find region
324324 //The IMDS endpoint is only available from within an Azure environment, so the most common cause of this
325325 // exception will likely be java.net.SocketException: Network is unreachable: connect
326- log .warn ("Exception during call to local IMDS endpoint: {}" , ex .getMessage ());
326+ LOG .warn ("Exception during call to local IMDS endpoint: {}" , ex .getMessage ());
327327 currentRequest .regionSource (RegionTelemetry .REGION_SOURCE_FAILED_AUTODETECT .telemetryValue );
328328 future .cancel (true );
329329
0 commit comments