【问题标题】:The google cloud dataflow eclipse plugin is not able to show the TRACE logs or any logs below error when configured配置时,谷歌云数据流 Eclipse 插件无法显示 TRACE 日志或以下错误的任何日志
【发布时间】:2016-10-01 03:01:55
【问题描述】:

当我按照文档配置将 workerLogLevelOverrides 设置为 {\"com.mycompany.testdataflow.StarterPipeline\":\"TRACE\"} 的 google cloud dataflow eclipse 插件时,我无法看到日志

奇怪的是,错误级别的配置似乎显示了日志,但任何更低的都不会。

有人遇到过这个吗?

这是我用来尝试输出日志的代码段

私有静态最终Logger LOG = LoggerFactory.getLogger(StarterPipeline.class);

public static void main(String[] args) {
    Pipeline p = Pipeline.create(PipelineOptionsFactory.fromArgs(args).withValidation().create());

    for (String string : args) {
        // System.out.println("########## "+string);
        LOG.trace("Doing the trace for pipeline ##### Parameter is #### " + string);

        LOG.trace("Doing the trace for pipeline ##### Parameter is #### ");
    }

    LOG.trace("Doing the trace for pipeline");
    p.apply(Create.of("Hello", "World")).apply(ParDo.of(new DoFn<String, String>() {
        @Override
        public void processElement(ProcessContext c) {
            LOG.trace("Doing the trace for pipeline");
            c.output(c.element().toUpperCase());
        }
    })).apply(ParDo.of(new DoFn<String, Void>() {
        @Override
        public void processElement(ProcessContext c) {
            LOG.trace("Doing the trace for pipeline");
            LOG.info(c.element());
        }
    }));

这来自数据流示例,除了我添加的日志以查看我是否能够看到任何日志。

【问题讨论】:

  • 您使用的是什么 PipelineRunner?你在哪里寻找日志?您在寻找哪种登录方式?你看过关于日志的DebuggingWordCount example 吗?
  • @BenChambers 感谢您的快速回复。我正在使用 BlockingDataflowPipelineRunner ,我正在控制台(eclipse 控制台)上寻找日志,例如 LOG.trace("Doing the trace for pipeline ##### Parameter is #### ");这是我刚刚添加的日志行,用于查看控制台上正在写入的内容。但即使我在日志下查看谷歌云控制台时,我也看不到我正在寻找的日志,事实上在日志级别中没有 TRACE

标签: google-cloud-dataflow


【解决方案1】:

使用BlockingDataflowPipelineRunnerDataflowPipelineRunner 运行管道时,需要执行两个部分。首先,您的主要方法在您的机器上本地运行以生成管道。当您调用 p.run() 时,管道将被发送到 Dataflow 服务,并在该服务上运行(可能很多)虚拟机。

直接在main 方法中的日志语句(例如“Doing the trace for pipeline ...”)发生在您的机器上,并将显示在 Eclipse 控制台中。 DoFns 中的日志语句发生在虚拟机上,并且仅显示在 Cloud Logging 中,如 DebuggingWordCount example 中所述。

指定workerLogLevelOverrides 会影响工作虚拟机的日志级别。因此,更改该值将影响 DoFns 记录到 Cloud Logging 的内容。

要调整您机器上运行的代码的日志级别(即main 方法),您需要调整运行主程序的 SLF4J 或 java.util.logging 日志级别。例如,these instructions on Stack Overflow 建议使用日志配置文件。

【讨论】:

  • 就是这个了,我看错地方了,google云日志里居然可以看到日志。一个问题是过滤器部分的日志级别中没有跟踪,我看到跟踪日志显示为 DEBUG 严重性看起来这是谷歌的意图,但它现在有效。谢谢。
猜你喜欢
  • 2016-06-18
  • 2022-07-16
  • 2012-08-10
  • 2021-05-24
  • 1970-01-01
  • 2020-03-14
  • 2023-03-25
  • 2021-05-15
  • 2021-06-16
相关资源
最近更新 更多