tvalentyn commented on code in PR #23635:
URL: https://github.com/apache/beam/pull/23635#discussion_r998838083


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java:
##########
@@ -344,4 +347,36 @@ public static SdkHarnessLogLevelOverrides from(Map<String, 
String> values) {
   List<String> getJdkAddOpenModules();
 
   void setJdkAddOpenModules(List<String> options);
+
+  /**
+   * Configure log manager's default log level and log level overrides from 
the sdk harness options,
+   * and return the list of configured loggers.
+   */
+  static List<Logger> getConfiguredLoggerFromOptions(SdkHarnessOptions 
loggingOptions) {
+    ArrayList<Logger> configuredLoggers = new ArrayList<>();
+    LogManager logManager = LogManager.getLogManager();
+    Logger rootLogger = logManager.getLogger("");
+
+    // Use the passed in logging options to configure the various logger 
levels.
+    if (loggingOptions.getDefaultSdkHarnessLogLevel() != null) {
+      rootLogger.setLevel(

Review Comment:
   from reading this method it's not clear why rootLogger is not included into 
the configuredLoggers. should we modify the root logger separately, for example 
where this method is called?



##########
runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/Environments.java:
##########
@@ -448,6 +451,39 @@ public static String 
getExternalServiceAddress(PortablePipelineOptions options)
     return environmentOption;
   }
 
+  /**
+   * Configure log manager's default log level and log level overrides from 
the sdk harness options,
+   * and return the list of configured loggers.
+   */
+  public static List<java.util.logging.Logger> getConfiguredLoggerFromOptions(

Review Comment:
   Took another look, agree that it is looks somewhat unnatural to modify the 
global context, especially the root logger. We can ask for second opinion on 
this from someone who does more work on Java SDK. 
   @kennknowles  might have good advice. 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to