From b251e7e60367031fbe051e070df0761a3206c594 Mon Sep 17 00:00:00 2001 From: CaiHQ Date: Fri, 10 Jun 2022 16:10:51 +0800 Subject: [PATCH] contract client --- src/main/java/org/bdware/sc/ContractClient.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/bdware/sc/ContractClient.java b/src/main/java/org/bdware/sc/ContractClient.java index 42ee4e8..8512dc5 100644 --- a/src/main/java/org/bdware/sc/ContractClient.java +++ b/src/main/java/org/bdware/sc/ContractClient.java @@ -262,7 +262,7 @@ public class ContractClient { new ProcessBuilder( "java", "-Dfile.encoding=UTF-8", - darg, + darg, (isDebug ? "-Dlog4j.configurationFile=./log4j2.cp.properties" : ""), "-jar", classpath, "-port=" + startPort, @@ -317,10 +317,16 @@ public class ContractClient { get.syncGet("", "setDBInfo", ContractManager.dbPath); String tagA = (ps == System.out ? "[Contract_" + port + "_out] " : ""); String tagB = (ps == System.out ? "[Contract_" + port + "_err] " : ""); - outputTracer.track(process, sc, tagA, ps); - errorTracer.track(process, new Scanner(process.getErrorStream()), tagB, ps); - get.syncGet("", "registerMangerPort", String.valueOf(ContractManager.cPort.getCMPort())); + if (isDebug) { + LOGGER.debug("start as Debug, track err/out"); + outputTracer.track(process, sc, tagA, ps); + errorTracer.track(process, new Scanner(process.getErrorStream()), tagB, ps); + } else { + LOGGER.debug("start, do not track err/out"); + sc.close(); + } + get.syncGet("", "registerMangerPort", String.valueOf(ContractManager.cPort.getCMPort())); if (isBundlePath(contractMeta.contract.getScriptStr())) { status = get.syncGet(