Skip to content

Commit 902e5fc

Browse files
committed
Factor out logging from CgroupSubsystemFactory.create
1 parent b4e2248 commit 902e5fc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ public static CgroupMetrics create(Optional<CgroupTypeResult> optResult) {
104104
// not ready to deal with that on a per-controller basis. Return no metrics
105105
// in that case
106106
if (result.isAnyCgroupV1Controllers() && result.isAnyCgroupV2Controllers()) {
107-
Logger logger = System.getLogger("jdk.internal.platform");
108-
logger.log(Level.DEBUG, "Mixed cgroupv1 and cgroupv2 not supported. Metrics disabled.");
107+
warn("Mixed cgroupv1 and cgroupv2 not supported. Metrics disabled.");
109108
return null;
110109
}
111110

@@ -121,6 +120,11 @@ public static CgroupMetrics create(Optional<CgroupTypeResult> optResult) {
121120
}
122121
}
123122

123+
private static void warn(String msg) {
124+
Logger logger = System.getLogger("jdk.internal.platform");
125+
logger.log(Level.DEBUG, msg);
126+
}
127+
124128
/*
125129
* Determine the type of the cgroup system (v1 - legacy or hybrid - or, v2 - unified)
126130
* based on three files:

0 commit comments

Comments
 (0)