簡體   English   中英

在 spring 引導應用程序中禁用 com.azure.core.util.logging.ClientLogger

[英]Disable com.azure.core.util.logging.ClientLogger in a spring boot application

我正在嘗試禁用com.azure.core.util.logging.ClientLogger在 spring 引導應用程序中關於 eventhub 的非常詳細的日志記錄。

我在 spring 啟動應用程序中有以下 azure 的依賴項

    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>azure-spring-cloud-stream-binder-eventhubs</artifactId>
        <version>2.9.0</version>
    </dependency>
    <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-messaging-eventhubs-checkpointstore-blob</artifactId>
        <version>1.10.0</version>
    </dependency>

我的 log4j2.xml 中有以下內容

<Loggers>
    <Logger name="com.azure.core.util.logging" level="ERROR" />
    <Logger name="org.springframework" level="ERROR" />

    <Root level="info">
        <AppenderRef ref="ConsoleAppender" />
    </Root>
</Loggers>

我還嘗試將以下環境變量設置為此值:AZURE_LOG_LEVEL=Error

這一切都是為了禁用控制台中進行的非常詳細的客戶端日志記錄。

但是這些嘗試都沒有成功地禁用日志記錄。 我還能做些什么來阻止這種日志恐怖?

這是我的日志依賴解決方案

[INFO] +- org.springframework.boot:spring-boot-starter-log4j2:jar:2.4.4:compile
[INFO] |  +- org.apache.logging.log4j:log4j-slf4j-impl:jar:2.13.3:compile
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] |  |  \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] |  +- org.apache.logging.log4j:log4j-core:jar:2.13.3:compile
[INFO] |  +- org.apache.logging.log4j:log4j-jul:jar:2.13.3:compile
[INFO] |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] +- org.apache.logging.log4j:log4j-layout-template-json:jar:2.14.1:compile

您是否嘗試過在“警告”state 上設置日志級別? 檢查這個 repo,因為它可能有幫助: https://github.com/anthonychu/functions-log-suppression

示例:“日志記錄:日志級別:Function.graphql”:“警告”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM