每当我使用AWS Java SDK时,我都会被疯狂的日志轰炸,因为它被设置为调试,我无法让它保持稳定。
以下是带有-Dlog4j.debug
标志的输出结果。
它显示我的log4j.properties文件已被读取和解析。使用根记录器位于OFF
和com.amazonaws
位于WARN
,但我仍然看到调试级别记录。我错过了什么吗?
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@42a57993.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@42a57993 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@42a57993.
log4j: Using URL [jar:file:/p-test/target/scala-2.11/phoenix-test-assembly-81fc4750d1.jar!/log4j.properties] for automatic log4j configuration.
log4j: Reading configuration from URL jar:file:/p-test/target/scala-2.11/phoenix-test-assembly-81fc4750d1.jar!/log4j.properties
log4j: Parsing for [root] with value=[OFF].
log4j: Level token is [OFF].
log4j: Category root set to OFF
log4j: Parsing for [com.amazonaws.AmazonWebServiceClient] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category com.amazonaws.AmazonWebServiceClient set to WARN
log4j: Handling log4j.additivity.com.amazonaws.AmazonWebServiceClient=[null]
log4j: Parsing for [org.apache.http.wire] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category org.apache.http.wire set to WARN
log4j: Handling log4j.additivity.org.apache.http.wire=[null]
log4j: Parsing for [com.amazonaws] with value=[WARN].
log4j: Level token is [WARN].
log4j: Category com.amazonaws set to WARN
log4j: Handling log4j.additivity.com.amazonaws=[null]
log4j: Finished configuring.
17:30:39.808 [main] INFO c.g.e.p.PhoenixTestApplication$ - ### Starting Phoenix write test
17:30:39.814 [main] INFO c.g.e.p.PhoenixTestApplication$ - numThreads: x10
17:30:39.815 [main] INFO c.g.e.p.PhoenixTestApplication$ - maxThreads: x10
17:30:39.815 [main] INFO c.g.e.p.PhoenixTestApplication$ - ### initializing ###
17:30:39.884 [main] DEBUG com.amazonaws.AmazonWebServiceClient - Internal logging successfully configured to commons logger: true
17:30:39.953 [main] DEBUG com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
17:30:40.103 [main] DEBUG c.a.internal.config.InternalConfig - Configuration override awssdk_config_override.json not found.
18:01:51.313 [ForkJoinPool-1-worker-171] DEBUG c.a.services.s3.AmazonS3Client - Bucket region cache doesn't have an entry for bucket. Trying to get bucket region from Amazon S3.
18:01:51.313 [ForkJoinPool-1-worker-239] DEBUG c.a.services.s3.AmazonS3Client - Bucket region cache doesn't have an entry for bucket. Trying to get bucket region from Amazon S3.
18:01:51.313 [ForkJoinPool-1-worker-219] DEBUG c.a.services.s3.AmazonS3Client - Bucket region cache doesn't have an entry for bucket. Trying to get bucket region from Amazon S3.
18:01:51.313 [ForkJoinPool-1-worker-47] DEBUG c.a.services.s3.AmazonS3Client - Bucket region cache doesn't have an entry for bucket. Trying to get bucket region from Amazon S3.
18:01:51.313 [ForkJoinPool-1-worker-73] DEBUG c.a.services.s3.AmazonS3Client - Bucket region cache doesn't have an entry for bucket. Trying to get bucket region from Amazon S3.
答案 0 :(得分:0)
AWS SDK 使用 logback 而不是 log4j,因此您必须在资源文件夹中定义 logback.xml 配置文件