google 云数据流 eclipse 插件在配置时无法显示 TRACE 日志或任何低于错误的日志
The google cloud dataflow eclipse plugin is not able to show the TRACE logs or any logs below error when configured
当我按照文档配置 google 云数据流 eclipse 插件时,我无法看到日志,该插件将 workerLogLevelOverrides 设置为 {\"com.mycompany.testdataflow.StarterPipeline\":\"TRACE\"}
奇怪的是,为 ERROR 级别执行此配置似乎显示了日志,但任何更低的级别都没有。
有人遇到过这个吗?
这是我用来尝试输出日志的代码段
private static final 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());
}
}));
这来自数据流示例,除了我添加的日志记录以查看我是否能够看到任何日志。
当运行使用BlockingDataflowPipelineRunner
或DataflowPipelineRunner
连接管道时,有两个部分要执行。首先,您的主要方法是 运行 在您的机器上本地生成管道。当您调用 p.run()
时,管道被传送到数据流服务,它 运行 在(可能很多)虚拟机上。
直接在 main
方法中的日志语句(例如 "Doing the trace for pipeline ...")发生在您的计算机上,并且会显示在 Eclipse 控制台中。 DoFn
内的日志语句发生在虚拟机上,并且仅显示在 Cloud Logging 中,如 DebuggingWordCount example 中所述。
指定workerLogLevelOverrides
会影响工作虚拟机的日志级别。因此,更改该值将影响 DoFn
记录到 Cloud Logging 的内容。
要在您的机器上调整代码 运行ning 的日志级别(因此 main
方法)您需要调整主程序所在的 SLF4J 或 java.util.logging 日志级别运行 同。例如,these instructions on Stack Overflow 建议使用日志配置文件。
当我按照文档配置 google 云数据流 eclipse 插件时,我无法看到日志,该插件将 workerLogLevelOverrides 设置为 {\"com.mycompany.testdataflow.StarterPipeline\":\"TRACE\"}
奇怪的是,为 ERROR 级别执行此配置似乎显示了日志,但任何更低的级别都没有。
有人遇到过这个吗?
这是我用来尝试输出日志的代码段
private static final 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());
}
}));
这来自数据流示例,除了我添加的日志记录以查看我是否能够看到任何日志。
当运行使用BlockingDataflowPipelineRunner
或DataflowPipelineRunner
连接管道时,有两个部分要执行。首先,您的主要方法是 运行 在您的机器上本地生成管道。当您调用 p.run()
时,管道被传送到数据流服务,它 运行 在(可能很多)虚拟机上。
直接在 main
方法中的日志语句(例如 "Doing the trace for pipeline ...")发生在您的计算机上,并且会显示在 Eclipse 控制台中。 DoFn
内的日志语句发生在虚拟机上,并且仅显示在 Cloud Logging 中,如 DebuggingWordCount example 中所述。
指定workerLogLevelOverrides
会影响工作虚拟机的日志级别。因此,更改该值将影响 DoFn
记录到 Cloud Logging 的内容。
要在您的机器上调整代码 运行ning 的日志级别(因此 main
方法)您需要调整主程序所在的 SLF4J 或 java.util.logging 日志级别运行 同。例如,these instructions on Stack Overflow 建议使用日志配置文件。