配置 Bigtable 和 gRPC 日志记录

configure Bigtable and gRPC logging

我想像我的应用程序的其他模块一样从 Google Cloud Bigtable (gRPC) 配置日志记录

SLF4J/log4j 的日志,其属性配置为从 spark

中关闭 INFO 日志
2017-01-11 10:44:08 INFO  algoServingLauncherTest$:12 - Starting algo Serving...
2017-01-11 10:44:09 INFO  MongoDBAlgorithm$:12 - Retrieving all algorithms from mongodb://mongo:27017/mycompany/algorithms...
2017-01-11 10:44:09 INFO  MongoDBAlgorithmHandler$:12 - Algorithms retrieval succeeded (1 algorithms)
2017-01-11 10:44:09 INFO  MongoDBPredictor$:12 - Retrieving all predictors from mongodb://mongo:27017/mycompany/predictors...
2017-01-11 10:44:09 INFO  MongoDBPredictorHandler$:12 - Predictors retrieval succeeded (13 predictors)

来自 Bigtable gRPC 的日志

Jan 11, 2017 10:44:23 AM com.google.bigtable.repackaged.io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@1cf6d1be] Created with target directaddress:///bigtable.googleapis.com/[omitted]:443
Jan 11, 2017 10:44:23 AM com.google.bigtable.repackaged.io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@4b29d1d2] Created with target directaddress:///bigtable.googleapis.com/[omitted]:443
Jan 11, 2017 10:44:23 AM com.google.bigtable.repackaged.io.grpc.internal.ManagedChannelImpl <init>
INFO: [ManagedChannelImpl@7f485fda] Created with target directaddress:///bigtable.googleapis.com/[omitted]:443

我想强制日志记录使用 SLF4J/Log4j。

我该怎么办?

感谢您的帮助

不幸的是,grpc 中没有现有的直接 SLF4J 集成; grpc 目前使用 java.util.logging 有一些复杂性。

您可能想阅读 open GitHub issue which discusses this in a lot more detail, and in particular this comment suggests that you may have some success with SLF4JBridgeHandler