Repository: incubator-beam
Updated Branches:
  refs/heads/master e1b305ea5 -> 915bc198d


Add configuration for Dataflow runner System.out/err


Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/874e199e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/874e199e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/874e199e

Branch: refs/heads/master
Commit: 874e199efbaa02e7299b2919b55a0c5f73287257
Parents: e1b305e
Author: Scott Wegner <[email protected]>
Authored: Mon May 16 14:01:43 2016 -0700
Committer: Luke Cwik <[email protected]>
Committed: Mon Jun 13 14:28:42 2016 -0700

----------------------------------------------------------------------
 .../options/DataflowWorkerLoggingOptions.java   | 79 +++++++++++++++-----
 1 file changed, 62 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/874e199e/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowWorkerLoggingOptions.java
----------------------------------------------------------------------
diff --git 
a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowWorkerLoggingOptions.java
 
b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowWorkerLoggingOptions.java
index 74ab59a..dc7748a 100644
--- 
a/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowWorkerLoggingOptions.java
+++ 
b/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/options/DataflowWorkerLoggingOptions.java
@@ -38,7 +38,23 @@ public interface DataflowWorkerLoggingOptions extends 
PipelineOptions {
    * The set of log levels that can be used on the Dataflow worker.
    */
   public enum Level {
-    DEBUG, ERROR, INFO, TRACE, WARN
+    /** Special level used to turn off logging. */
+    OFF,
+
+    /** Level for logging error messages. */
+    ERROR,
+
+    /** Level for logging warning messages. */
+    WARN,
+
+    /** Level for logging informational messages. */
+    INFO,
+
+    /** Level for logging diagnostic messages. */
+    DEBUG,
+
+    /** Level for logging tracing messages. */
+    TRACE
   }
 
   /**
@@ -50,6 +66,34 @@ public interface DataflowWorkerLoggingOptions extends 
PipelineOptions {
   void setDefaultWorkerLogLevel(Level level);
 
   /**
+   * Controls the log level given to messages printed to {@code System.out}.
+   *
+   * <p>Note that the message may be filtered depending on the
+   * {@link #getDefaultWorkerLogLevel defaultWorkerLogLevel} or if a {@code 
System.out} override is
+   * specified via {@link #getWorkerLogLevelOverrides workerLogLevelOverrides}.
+   */
+  @Description("Controls the log level given to messages printed to 
System.out. Note that the "
+      + "message may be filtered depending on the defaultWorkerLogLevel or if 
a 'System.out' "
+      + "override is specified via workerLogLevelOverrides.")
+  @Default.Enum("INFO")
+  Level getWorkerSystemOutMessageLevel();
+  void setWorkerSystemOutMessageLevel(Level level);
+
+  /**
+   * Controls the log level given to messages printed to {@code System.err}.
+   *
+   * <p>Note that the message may be filtered depending on the
+   * {@link #getDefaultWorkerLogLevel defaultWorkerLogLevel} or if a {@code 
System.err} override is
+   * specified via {@link #getWorkerLogLevelOverrides workerLogLevelOverrides}.
+   */
+  @Description("Controls the log level given to messages printed to 
System.err. Note that the "
+      + "message may be filtered depending on the defaultWorkerLogLevel or if 
a 'System.err' "
+      + "override is specified via workerLogLevelOverrides.")
+  @Default.Enum("ERROR")
+  Level getWorkerSystemErrMessageLevel();
+  void setWorkerSystemErrMessageLevel(Level level);
+
+  /**
    * This option controls the log levels for specifically named loggers.
    *
    * <p>Later options with equivalent names override earlier options.
@@ -60,26 +104,25 @@ public interface DataflowWorkerLoggingOptions extends 
PipelineOptions {
    * {@link WorkerLogLevelOverrides#from}.
    */
   @Description("This option controls the log levels for specifically named 
loggers. "
-      + "The expected format is {\"Name\":\"Level\",...}. The Dataflow worker 
uses "
-      + "java.util.logging, which supports a logging hierarchy based off of 
names that are '.' "
-      + "separated. For example, by specifying the value 
{\"a.b.c.Foo\":\"DEBUG\"}, the logger "
-      + "for the class 'a.b.c.Foo' will be configured to output logs at the 
DEBUG level. "
-      + "Similarly, by specifying the value {\"a.b.c\":\"WARN\"}, all loggers 
underneath the "
-      + "'a.b.c' package will be configured to output logs at the WARN level. 
Also, note that "
-      + "when multiple overrides are specified, the exact name followed by the 
closest parent "
-      + "takes precedence.")
+      + "The expected format is {\"Name\":\"Level\",...}. The Dataflow worker 
supports a logging "
+      + "hierarchy based off of names that are '.' separated. For example, by 
specifying the value "
+      + "{\"a.b.c.Foo\":\"DEBUG\"}, the logger for the class 'a.b.c.Foo' will 
be configured to "
+      + "output logs at the DEBUG level. Similarly, by specifying the value 
{\"a.b.c\":\"WARN\"}, "
+      + "all loggers underneath the 'a.b.c' package will be configured to 
output logs at the WARN "
+      + "level. System.out and System.err levels are configured via loggers of 
the corresponding "
+      + "name. Also, note that when multiple overrides are specified, the 
exact name followed by "
+      + "the closest parent takes precedence.")
   WorkerLogLevelOverrides getWorkerLogLevelOverrides();
   void setWorkerLogLevelOverrides(WorkerLogLevelOverrides value);
 
   /**
    * Defines a log level override for a specific class, package, or name.
    *
-   * <p>{@code java.util.logging} is used on the Dataflow worker harness and 
supports
-   * a logging hierarchy based off of names that are "." separated. It is a 
common
-   * pattern to have the logger for a given class share the same name as the 
class itself.
-   * Given the classes {@code a.b.c.Foo}, {@code a.b.c.Xyz}, and {@code 
a.b.Bar}, with
-   * loggers named {@code "a.b.c.Foo"}, {@code "a.b.c.Xyz"}, and {@code 
"a.b.Bar"} respectively,
-   * we can override the log levels:
+   * <p>The Dataflow worker harness supports a logging hierarchy based off of 
names that are "."
+   * separated. It is a common pattern to have the logger for a given class 
share the same name as
+   * the class itself. Given the classes {@code a.b.c.Foo}, {@code a.b.c.Xyz}, 
and {@code a.b.Bar},
+   * with loggers named {@code "a.b.c.Foo"}, {@code "a.b.c.Xyz"}, and {@code 
"a.b.Bar"}
+   * respectively, we can override the log levels:
    * <ul>
    *    <li>for {@code Foo} by specifying the name {@code "a.b.c.Foo"} or the 
{@link Class}
    *    representing {@code a.b.c.Foo}.
@@ -87,8 +130,10 @@ public interface DataflowWorkerLoggingOptions extends 
PipelineOptions {
    *    the {@link Package} representing {@code a.b}.
    *    <li>for {@code Foo} and {@code Bar} by specifying both of their names 
or classes.
    * </ul>
-   * Note that by specifying multiple overrides, the exact name followed by 
the closest parent
-   * takes precedence.
+   *
+   * <p>{@code System.out} and {@code System.err} messages are configured via 
loggers of the
+   * corresponding name. Note that by specifying multiple overrides, the exact 
name followed by the
+   * closest parent takes precedence.
    */
   public static class WorkerLogLevelOverrides extends HashMap<String, Level> {
     /**

Reply via email to