Skip to content

Commit 9cad4b1

Browse files
committed
Merge branch 'develop' into qianjin-sqlserver
2 parents 211bc59 + ef6c4ab commit 9cad4b1

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

Utils/azuretools-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@
194194
<groupId>com.squareup.retrofit2</groupId>
195195
<artifactId>retrofit</artifactId>
196196
</dependency>
197+
<dependency>
198+
<groupId>log4j</groupId>
199+
<artifactId>log4j</artifactId>
200+
</dependency>
197201
<dependency>
198202
<groupId>com.microsoft.azure</groupId>
199203
<artifactId>azure</artifactId>

Utils/azuretools-core/src/com/microsoft/azuretools/authmanage/AuthMethodManager.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package com.microsoft.azuretools.authmanage;
77

88
import com.azure.core.implementation.http.HttpClientProviders;
9+
import com.microsoft.aad.msal4j.PublicClientApplication;
910
import com.microsoft.azure.management.Azure;
1011
import com.microsoft.azure.management.appplatform.v2020_07_01.implementation.AppPlatformManager;
1112
import com.microsoft.azure.management.mysql.v2020_01_01.implementation.MySQLManager;
@@ -28,8 +29,9 @@
2829
import com.microsoft.azuretools.telemetrywrapper.EventUtil;
2930
import com.microsoft.azuretools.utils.AzureUIRefreshCore;
3031
import com.microsoft.azuretools.utils.AzureUIRefreshEvent;
31-
import reactor.core.publisher.Mono;
32-
import reactor.core.scheduler.Schedulers;
32+
33+
import org.apache.log4j.Level;
34+
import org.apache.log4j.Logger;
3335

3436
import java.io.IOException;
3537
import java.nio.charset.StandardCharsets;
@@ -40,14 +42,21 @@
4042
import java.util.Set;
4143
import java.util.concurrent.CompletableFuture;
4244
import java.util.concurrent.ExecutionException;
43-
import java.util.logging.Logger;
4445
import java.util.stream.Collectors;
4546

4647
import static com.microsoft.azuretools.Constants.FILE_NAME_AUTH_METHOD_DETAILS;
47-
import static com.microsoft.azuretools.telemetry.TelemetryConstants.*;
48+
import static com.microsoft.azuretools.telemetry.TelemetryConstants.ACCOUNT;
49+
import static com.microsoft.azuretools.telemetry.TelemetryConstants.AZURE_ENVIRONMENT;
50+
import static com.microsoft.azuretools.telemetry.TelemetryConstants.RESIGNIN;
51+
import static com.microsoft.azuretools.telemetry.TelemetryConstants.SIGNIN_METHOD;
52+
53+
import reactor.core.publisher.Hooks;
54+
import reactor.core.publisher.Mono;
55+
import reactor.core.scheduler.Schedulers;
4856

4957
public class AuthMethodManager {
50-
private static final Logger LOGGER = Logger.getLogger(AuthMethodManager.class.getName());
58+
private static final org.apache.log4j.Logger LOGGER =
59+
org.apache.log4j.Logger.getLogger(PublicClientApplication.class);
5160
private AuthMethodDetails authMethodDetails;
5261
private final Set<Runnable> signInEventListeners = new HashSet<>();
5362
private final Set<Runnable> signOutEventListeners = new HashSet<>();
@@ -57,6 +66,7 @@ public class AuthMethodManager {
5766
static {
5867
// fix the class load problem for intellij plugin
5968
ClassLoader current = Thread.currentThread().getContextClassLoader();
69+
Logger.getLogger(com.microsoft.aad.adal4j.AuthenticationContext.class).setLevel(Level.OFF);
6070
try {
6171
Thread.currentThread().setContextClassLoader(AuthMethodManager.class.getClassLoader());
6272
HttpClientProviders.createInstance();
@@ -83,7 +93,7 @@ private AuthMethodManager() {
8393
try {
8494
initAuthMethodManagerFromSettings();
8595
} catch (Throwable ex) {
86-
LOGGER.warning("Cannot restore login due to error: " + ex.getMessage());
96+
LOGGER.warn("Cannot restore login due to error: " + ex.getMessage());
8797
}
8898
return true;
8999
}).subscribeOn(Schedulers.boundedElastic()).subscribe();
@@ -255,7 +265,7 @@ private void initAuthMethodManagerFromSettings() {
255265
}
256266
case AD:
257267
// we don't support it now
258-
LOGGER.warning("The AD auth method is not supported now, ignore the credential.");
268+
LOGGER.warn("The AD auth method is not supported now, ignore the credential.");
259269
break;
260270
case SP:
261271
targetAuthMethodDetails.setAuthType(AuthType.SERVICE_PRINCIPAL);

0 commit comments

Comments
 (0)