aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tools-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'tools/tools-common/src/main')
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/Console.java3
-rw-r--r--tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java10
2 files changed, 11 insertions, 2 deletions
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 28337fdeb..aacc22013 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,8 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StrBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.slf4j.ext.XLoggerFactory;
import org.slf4j.helpers.MessageFormatter;
@@ -36,7 +38,6 @@ import org.slf4j.helpers.MessageFormatter;
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
public final class Console {
-
/** The console as static object. */
public static final Console CONSOLE = new Console();
diff --git a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java
index b529a7e08..59d15d19d 100644
--- a/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java
+++ b/tools/tools-common/src/main/java/org/onap/policy/apex/tools/common/OutputFile.java
@@ -32,6 +32,8 @@ import java.nio.file.Path;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Standard output file handling and tests.
@@ -39,6 +41,8 @@ import org.apache.commons.lang3.Validate;
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
public class OutputFile {
+ // Get a reference to the logger
+ private static final Logger LOGGER = LoggerFactory.getLogger(OutputFile.class);
/** The output file name. */
private final String fileName;
@@ -86,6 +90,7 @@ public class OutputFile {
try {
return new BufferedWriter(new FileWriter(toFile()));
} catch (final IOException e) {
+ LOGGER.warn("write error", e);
return null;
}
}
@@ -99,6 +104,7 @@ public class OutputFile {
try {
return new FileOutputStream(toFile());
} catch (final IOException e) {
+ LOGGER.warn("stream creation error", e);
return null;
}
}
@@ -123,7 +129,9 @@ public class OutputFile {
try {
file.createNewFile();
} catch (final IOException e) {
- return "could not create output file: " + e.getMessage();
+ String message = "could not create output file: " + e.getMessage();
+ LOGGER.warn(message, e);
+ return message;
}
}