【问题标题】:configure Bigtable and gRPC logging配置 Bigtable 和 gRPC 日志记录
【发布时间】:2017-01-11 11:34:47
【问题描述】:

我想像我的应用程序的其他模块一样配置来自 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。

我该怎么办?

感谢您的帮助

【问题讨论】:

    标签: java slf4j google-cloud-bigtable grpc-java


    【解决方案1】:

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

    您可能想阅读open GitHub issue,它更详细地讨论了这一点,特别是this comment 建议您使用SLF4JBridgeHandler 可能会取得一些成功。

    【讨论】:

    • 感谢您的帮助。是否可以禁用 INFO 日志记录?
    • OK 禁用 val log = java.util.logging.Logger.getGlobal 和 log.setLevel(java.util.logging.Level.OFF) 工作
    猜你喜欢
    • 1970-01-01
    • 2018-07-02
    • 2013-09-11
    • 2017-06-06
    • 2018-01-05
    • 1970-01-01
    • 2019-08-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多