summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java4
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java9
2 files changed, 7 insertions, 6 deletions
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java
index 588abfc6b..31692dc21 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/CliParser.java
@@ -81,8 +81,8 @@ public class CliParser {
try {
cmd = parser.parse(options, args);
} catch (final ParseException ex) {
- System.err.println("Parsing failed. Reason: " + ex.getMessage());
- ex.printStackTrace();
+ Console.CONSOLE.error("Parsing failed, see reason and cause below");
+ Console.CONSOLE.stacktrace(ex);
}
return cmd;
}
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
index 571333147..d76caa333 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java
@@ -25,6 +25,7 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StrBuilder;
+import org.slf4j.ext.XLoggerFactory;
import org.slf4j.helpers.MessageFormatter;
/**
@@ -326,12 +327,12 @@ public final class Console {
if (appName != null) {
System.err.print(appName + ": ");
}
- System.err.println("exception stack trace: ");
- System.err.println(" - message: " + exception.getMessage());
+ System.err.println(" exception message: " + exception.getMessage());
if (exception.getCause() != null) {
- System.err.println(" - cause: " + exception.getCause());
+ System.err.println(" exception cause: " + exception.getCause());
}
- exception.printStackTrace();
+ System.err.println("for exception stack trace, please refer logs.");
+ XLoggerFactory.getXLogger(Console.class).error("stacktrace", exception);
}
}