Skip to content

Commit

Permalink
Add AttachAPI TargetManager info
Browse files Browse the repository at this point in the history
Changed TargetManager log level from debug to info.

Signed-off-by: Jason Feng <fengj@ca.ibm.com>
  • Loading branch information
JasonFengJ9 committed Feb 16, 2023
1 parent 1c466cb commit dbb4063
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2001, 2020 IBM Corp. and others
* Copyright (c) 2001, 2023 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -116,13 +116,13 @@ public static boolean waitForAttachApiInitialization() {
int tries = 100;
RuntimeMXBean bean = (RuntimeMXBean) ManagementFactory.getRuntimeMXBean();
while (tries > 0) {
logger.debug("Poll attach API status");
logger.info("Poll attach API status");
if (bean.isAttachApiInitialized()) {
result = true;
logger.debug("attach API initialized");
logger.info("attach API initialized");
break;
} else if (bean.isAttachApiTerminated()) {
logger.debug("attach API terminated");
logger.info("attach API terminated");
result = false;
break;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ public TargetStatus readTargetPidAndStatus() {
targetLog.append(tgtOutput);
targetLog.append('\n');
} else {
logger.debug("TargetVM stdout closed unexpectedly");
logger.info("TargetVM stdout closed unexpectedly");
while (targetErrReader.ready()) {
String currentLine = targetErrReader.readLine();
if (null != currentLine) {
Expand All @@ -194,7 +194,7 @@ public TargetStatus readTargetPidAndStatus() {
tgtStatus = TargetStatus.INIT_FAILURE;
break;
}
logger.debug("TargetVM output: " + tgtOutput);
logger.info("TargetVM output: " + tgtOutput);
if (tgtOutput.startsWith(PID_PREAMBLE)) {
targetPid = tgtOutput.substring(PID_PREAMBLE.length());
}
Expand All @@ -217,14 +217,14 @@ public TargetStatus readTargetPidAndStatus() {
}
} while (!done);
if (null == targetPid) {
logger.debug("Target PID not set");
logger.info("Target PID not set");
tgtStatus = TargetStatus.INIT_FAILURE;
}
} catch (IOException e) {
StringPrintStream.logStackTrace(e, logger);
}
if (TargetStatus.INIT_SUCCESS != tgtStatus) {
logger.debug("TargetVM initialization failed with status "+tgtStatus.toString()+"\nTarget output:\n"+targetLog.toString());
logger.info("TargetVM initialization failed with status "+tgtStatus.toString()+"\nTarget output:\n"+targetLog.toString());
}
return tgtStatus;
}
Expand Down Expand Up @@ -267,7 +267,7 @@ private Process launchTarget(String cmdName, String tgtId,
char fs = File.separatorChar;
String javaExec = System.getProperty("java.home") + fs + "bin" + fs
+ "java";
logger.debug("javaExec="+javaExec);
logger.info("javaExec="+javaExec);
String sideCar = System.getProperty("java.sidecar");
String myClasspath = System.getProperty("java.class.path");
argBuffer.add(javaExec);
Expand Down Expand Up @@ -307,7 +307,7 @@ private Process launchTarget(String cmdName, String tgtId,
debugBuffer.append(" ");
}
debugBuffer.append("\n");
logger.debug(debugBuffer.toString());
logger.info(debugBuffer.toString());
try {
target = me.exec(args);
} catch (IOException e) {
Expand All @@ -333,7 +333,7 @@ private Process launchTarget(String cmdName, String tgtId,
boolean syncWithTarget() {
targetVmStatus = readTargetPidAndStatus();
if (!TargetStatus.INIT_SUCCESS.equals(targetVmStatus)) {
logger.debug("TargetManager.syncWithTarget() failed!");
logger.info("TargetManager.syncWithTarget() failed!");
return false;
}
if (null == targetId) {
Expand All @@ -345,7 +345,7 @@ boolean syncWithTarget() {
static void listIpcDir() {
String tmpdir = System.getProperty("java.io.tmpdir")
+ File.separatorChar + DEFAULT_IPC_DIR;
logger.debug("DEBUG:" + tmpdir);
logger.info("DEBUG:" + tmpdir);
File ipcDir = new File(tmpdir);
if (ipcDir.exists()) {
listRecursive(System.getProperty("java.io.tmpdir"), ipcDir);
Expand All @@ -354,7 +354,7 @@ static void listIpcDir() {

static void listRecursive(String prefix, File root) {
String myPath = prefix + "/" + root.getName();
logger.debug(myPath);
logger.info(myPath);
if (root.isDirectory()) {
File[] children = root.listFiles();
if (null != children) {
Expand Down Expand Up @@ -453,7 +453,7 @@ public int terminateTarget(boolean waitForTermination) {
if (waitForTermination) {
try {
status = proc.waitFor();
logger.debug("waitFor status = " + status);
logger.info("waitFor status = " + status);
return status;
} catch (InterruptedException e) {
return 1;
Expand Down Expand Up @@ -500,7 +500,7 @@ public static void dumpLogs() {
public static void dumpLogs(boolean printLogs) {
try {
Class<?> attachHandlerClass = Class.forName(OPENJ9_INTERNAL_TOOLS_ATTACH_TARGET_ATTACH_HANDLER);
logger.debug("Dumping attach API logs");
logger.info("Dumping attach API logs");
File pwd = new File(System.getProperty("user.dir"));
File[] logFiles = pwd.listFiles();
final Method getVmId = attachHandlerClass.getMethod("getVmId");
Expand All @@ -513,7 +513,7 @@ public static void dumpLogs(boolean printLogs) {
if (logName.endsWith(".log")) {
if (printLogs) {
try {
logger.debug("Log file " + f.getName()+":\n"
logger.info("Log file " + f.getName()+":\n"
+ (new String(Files.readAllBytes(Paths.get(f.toURI())))));
} catch (IOException e) {
StringPrintStream.logStackTrace(e, logger);
Expand Down

0 comments on commit dbb4063

Please sign in to comment.