Skip to content

Commit 20da31f

Browse files
Move stdout direct logging under debug mode (#422)
* Move stdout direct logging under debug mode * addressed review comment
1 parent d0f19a9 commit 20da31f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

parser/src/main/java/com/microsoft/gctoolkit/parser/GCLogTrace.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33
package com.microsoft.gctoolkit.parser;
44

5+
import com.microsoft.gctoolkit.GCToolKit;
56
import com.microsoft.gctoolkit.event.GCCause;
67
import com.microsoft.gctoolkit.event.GCCauses;
78
import com.microsoft.gctoolkit.event.MemoryPoolSummary;
@@ -28,7 +29,6 @@ public class GCLogTrace extends AbstractLogTrace {
2829
private static final Logger LOGGER = Logger.getLogger(GCLogTrace.class.getName());
2930

3031
private final boolean gcCauseDebugging = Boolean.getBoolean("microsoft.debug.gccause");
31-
// private final boolean debugging = Boolean.getBoolean("microsoft.debug");
3232

3333
public GCLogTrace(Matcher matcher) {
3434
super(matcher);
@@ -292,15 +292,16 @@ public void notYetImplemented() {
292292
LOGGER.log(Level.FINE, "{0} : {1}", new Object[]{i, getGroup(i)});
293293
}
294294
LOGGER.fine("-----------------------------------------");
295-
//IntelliJ Eats this log output so it's displayed to stdout..
296-
//And yes, that means System.out.println is in here in on purpose
297-
//if ( debugging) {
298-
System.out.println(threadName + ", not implemented: " + getGroup(0));
299-
for (int i = 1; i < groupCount() + 1; i++) {
300-
System.out.println(i + ": " + getGroup(i));
301-
}
302-
System.out.println("-----------------------------------------");
303-
//}
295+
//IntelliJ Eats this log output, so it's displayed to stdout
296+
GCToolKit.LOG_DEBUG_MESSAGE(() -> {
297+
StringBuilder debugMessage = new StringBuilder();
298+
debugMessage.append(threadName).append(", not implemented: ").append(getGroup(0)).append(System.lineSeparator());
299+
for (int i = 1; i < groupCount() + 1; i++) {
300+
debugMessage.append(i).append(": ").append(getGroup(i)).append(System.lineSeparator());
301+
}
302+
debugMessage.append("-----------------------------------------");
303+
return debugMessage.toString();
304+
});
304305
}
305306

306307
public ZGCPhase getZCollectionPhase() {

0 commit comments

Comments
 (0)