简体   繁体   English

Azure 身份 API 记录了太多日志

[英]Azure-identity APIs logging too much logs

I am using azure-identity to authenticate and microsoft-graph apis to fetch data from Microsoft Teams.我正在使用 azure-identity 进行身份验证,并使用 microsoft-graph api 从 Microsoft Teams 获取数据。 Somehow azure-identity APIs are logging too much unwanted logs, those repetitive and not much of having important information, just like below.不知何故,azure-identity API 记录了太多不需要的日志,这些日志重复且没有太多重要信息,如下所示。

    2022-12-19 20:51:05.256  INFO 28050 --- [ol-1-worker-105] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.256  INFO 28050 --- [ool-1-worker-69] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.256  INFO 28050 --- [ool-1-worker-69] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.256  INFO 28050 --- [ol-1-worker-105] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.357  INFO 28050 --- [onPool-worker-5] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.358  INFO 28050 --- [onPool-worker-5] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.387  INFO 28050 --- [Pool-1-worker-3] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.387  INFO 28050 --- [Pool-1-worker-3] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.513  INFO 28050 --- [ool-1-worker-59] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.513  INFO 28050 --- [ool-1-worker-59] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.566  INFO 28050 --- [ool-1-worker-69] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.566  INFO 28050 --- [ool-1-worker-69] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.614  INFO 28050 --- [onPool-worker-5] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.614  INFO 28050 --- [onPool-worker-5] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.662  INFO 28050 --- [ool-1-worker-21] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.663  INFO 28050 --- [ool-1-worker-21] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS
2022-12-19 20:51:05.678  INFO 28050 --- [ol-1-worker-103] c.m.a.msal4j.AcquireTokenSilentSupplier  : Returning token from cache
2022-12-19 20:51:05.678  INFO 28050 --- [ol-1-worker-103] c.azure.identity.ClientSecretCredential  : Azure Identity => getToken() result for scopes [       https://graph.microsoft.com/.default]: SUCCESS  

My pom.xml entry for azure-identity and microsoft-graph is as below.我的 azure-identity 和 microsoft-graph 的 pom.xml 条目如下所示。

<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.6.1</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph</artifactId>
<version>5.17.0</version>
</dependency>

My Question is, is there any way to stop those logs, is there any way to control it?我的问题是,有没有办法停止这些日志,有没有办法控制它?

Found this as I am looking for the same solution.发现这个是因为我正在寻找相同的解决方案。

Looks like Microsoft requires an extra hoop to jump through to control the logging level of the MSAL library.看起来 Microsoft 需要一个额外的环来跳过以控制 MSAL 库的日志记录级别。

For Java: This involves creating a logging XML file and pointing to it with a System.properties setting.对于 Java:这涉及创建一个日志记录 XML 文件并使用 System.properties 设置指向它。 Setting the level to "error" or "warn" should stop these messages.将级别设置为“错误”或“警告”应该会停止这些消息。 https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-logging-java https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-logging-java

If your solution is not using Java, see this link for other implementations https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-client-application-configuration#logging如果您的解决方案未使用 Java,请参阅此链接了解其他实现https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-client-application-configuration#logging

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM