tillrohrmann commented on a change in pull request #9703: [FLINK-14038]Add 
default GC options for flink on yarn to facilitate debugging
URL: https://github.com/apache/flink/pull/9703#discussion_r339307818
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java
 ##########
 @@ -513,6 +519,56 @@ public static Configuration 
cloneConfiguration(Configuration configuration) {
                return clonedConfiguration;
        }
 
+       /**
+        * Format the default gc logging options
+        * @param logDirectory to save the gc log
+        * @param conf flink configuration
+        * @return the formatted gc logging options string
+        */
+       public static String getGCLoggingOpts(String logDirectory, 
Configuration conf) {
+               boolean enableGCLogging = 
conf.getBoolean(CoreOptions.FLINK_JVM_DEFAULT_GC_LOGGING);
+               if (enableGCLogging) {
+                       return "-Xloggc:" + logDirectory + "/gc.log " +
+                               "-XX:+PrintGCApplicationStoppedTime " +
+                               "-XX:+PrintGCDetails " +
+                               "-XX:+PrintGCDateStamps " +
+                               "-XX:+UseGCLogFileRotation " +
+                               "-XX:NumberOfGCLogFiles=10 " +
+                               "-XX:GCLogFileSize=10M " +
+                               "-XX:+PrintPromotionFailure " +
+                               "-XX:+PrintGCCause";
+               }
+               return "";
+       }
+
+       /**
+        * Format the default heapdump options
+        * @param appId application id
+        * @param ident the ident of the process, taskmanager/jobmanager
+        * @param logDirectory to print some logs
+        * @param conf flink configuration
+        * @return the formatted heapdump options string
+        */
+       public static String getHeapdumpOpts(String appId, String ident, String 
logDirectory, Configuration conf) {
+               boolean enableHeapDump = 
conf.getBoolean(CoreOptions.FLINK_JVM_HEAPDUMP_ON_OOM);
+               String heapdumpDir = 
conf.getString(CoreOptions.FLINK_JVM_HEAPDUMP_DIRECTORY);
 
 Review comment:
   I would suggest to pass in `heapdumpDir` directly because that way it is 
independent of `Configuration`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to