diff options
Diffstat (limited to 'datarouter-prov/src/main/java/org')
10 files changed, 59 insertions, 35 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java index d29876fb..7700a583 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java @@ -84,7 +84,7 @@ public class DB { HTTP_PORT = (String) props.get("org.onap.dmaap.datarouter.provserver.http.port");
Class.forName(DB_DRIVER);
} catch (IOException e) {
- intlogger.error("PROV9003 Opening properties: " + e.getMessage());
+ intlogger.error("PROV9003 Opening properties: " + e.getMessage(), e);
System.exit(1);
} catch (ClassNotFoundException e) {
intlogger.error("PROV9004 cannot find the DB driver: " + e);
@@ -115,6 +115,7 @@ public class DB { try {
connection = queue.remove();
} catch (NoSuchElementException nseEx) {
+ intlogger.error("PROV9006 No connection on queue: " + nseEx.getMessage(), nseEx);
int n = 0;
do {
// Try up to 3 times to get a connection
@@ -194,8 +195,7 @@ public class DB { runInitScript(connection, 1);
}
} catch (SQLException e) {
- intlogger
- .error("PROV9000: The database credentials are not working: " + e.getMessage());
+ intlogger.error("PROV9000: The database credentials are not working: " + e.getMessage(), e);
return false;
} finally {
if (connection != null) {
@@ -223,7 +223,7 @@ public class DB { rs.close();
}
} catch (SQLException e) {
- intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage());
+ intlogger.error("PROV9010: Failed to get TABLE data from DB: " + e.getMessage(), e);
}
return tables;
}
@@ -264,7 +264,7 @@ public class DB { lineReader.close();
strBuilder.setLength(0);
} catch (Exception e) {
- intlogger.error("PROV9002 Error when initializing table: " + e.getMessage());
+ intlogger.error("PROV9002 Error when initializing table: " + e.getMessage(), e);
System.exit(1);
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java index 46cfabec..d5521ba8 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRProvCadiFilter.java @@ -211,7 +211,7 @@ public class DRProvCadiFilter extends CadiFilter { } } catch (Exception e) { - intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: ", e.getMessage()); + intlogger.error("PROV0073 DRProvCadiFilter.isAAFFeed: " + e.getMessage(), e); return false; } return false; @@ -241,7 +241,7 @@ public class DRProvCadiFilter extends CadiFilter { intlogger.debug(message); } } catch (Exception e) { - intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: ", e.getMessage()); + intlogger.error("PROV0073 DRProvCadiFilter.isAAFSubscriber: " + e.getMessage(), e); return false; } return false; diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java index af8bd6d3..a593c8a7 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DRRouteCLI.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.provisioning.utils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -97,6 +99,7 @@ public class DRRouteCLI { public static final String ENV_VAR = "PROVSRVR";
public static final String PROMPT = "dr-route> ";
public static final String DEFAULT_TRUSTSTORE_PATH = /* $JAVA_HOME + */ "/jre/lib/security/cacerts";
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
private final String server;
private int width = 120; // screen width (for list)
@@ -130,12 +133,13 @@ public class DRRouteCLI { try {
trustStore.load(instream, truststore_pw.toCharArray());
} catch (Exception x) {
- System.err.println("Problem reading truststore: " + x);
+ intlogger.error("Problem reading truststore: " + x.getMessage(), x);
throw x;
} finally {
try {
instream.close();
} catch (Exception ignore) {
+ intlogger.error("Ignore error closing input stream: " + ignore.getMessage(), ignore);
}
}
}
@@ -397,6 +401,7 @@ public class DRRouteCLI { printErrorText(entity);
}
} catch (Exception e) {
+ intlogger.error("PROV0006 doDelete: " + e.getMessage(), e);
} finally {
meth.releaseConnection();
}
@@ -416,7 +421,7 @@ public class DRRouteCLI { printErrorText(entity);
}
} catch (Exception e) {
- System.err.println(e);
+ intlogger.error("PROV0005 doGet: " + e.getMessage(), e);
} finally {
meth.releaseConnection();
}
@@ -438,6 +443,7 @@ public class DRRouteCLI { printErrorText(entity);
}
} catch (Exception e) {
+ intlogger.error("PROV0009 doPost: " + e.getMessage(), e);
} finally {
meth.releaseConnection();
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java index 3aa3bd28..d9f36de3 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/HttpServletUtils.java @@ -32,7 +32,7 @@ public class HttpServletUtils { try { response.sendError(errorCode, message); } catch (IOException ioe) { - intlogger.error("IOException" + ioe.getMessage()); + intlogger.error("IOException" + ioe.getMessage(), ioe); } } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java index 915aa610..2d4e22b3 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/JSONUtilities.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.provisioning.utils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Collection;
@@ -35,6 +37,8 @@ import java.util.Collection; * @version $Id: JSONUtilities.java,v 1.1 2013/04/26 21:00:26 eby Exp $
*/
public class JSONUtilities {
+
+ private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog");
/**
* Does the String <i>v</i> represent a valid Internet address (with or without a
* mask length appended).
@@ -56,6 +60,7 @@ public class JSONUtilities { }
return true;
} catch (UnknownHostException e) {
+ intlogger.error("PROV0001: " + e.getMessage(), e);
return false;
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java index 1518859a..f7e08748 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LOGJSONObject.java @@ -23,6 +23,8 @@ package org.onap.dmaap.datarouter.provisioning.utils; * * ******************************************************************************/ +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; @@ -104,6 +106,8 @@ public class LOGJSONObject { */ private static Map<String, Object> keyPool = new LinkedHashMap<String, Object>(keyPoolSize); + private static final EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog"); + /** * JSONObject.NULL is equivalent to the value that JavaScript calls null, * whilst Java's null is equivalent to the value that JavaScript calls @@ -202,7 +206,7 @@ public class LOGJSONObject { * Construct an empty JSONObject. */ public LOGJSONObject() { - this.map = new LinkedHashMap<String, Object>(); + this.map = new LinkedHashMap<>(); } @@ -213,8 +217,6 @@ public class LOGJSONObject { * * @param jo A JSONObject. * @param names An array of strings. - * @throws JSONException - * @throws JSONException If a value is a non-finite number or if a name is duplicated. */ public LOGJSONObject(LOGJSONObject jo, String[] names) { this(); @@ -222,6 +224,7 @@ public class LOGJSONObject { try { this.putOnce(names[i], jo.opt(names[i])); } catch (Exception ignore) { + intlogger.error("PROV0001 LOGJSONObject: " + ignore.getMessage(), ignore); } } } @@ -234,7 +237,7 @@ public class LOGJSONObject { * @throws JSONException If there is a syntax error in the source string * or a duplicated key. */ - public LOGJSONObject(JSONTokener x) throws JSONException { + public LOGJSONObject(JSONTokener x) { this(); char c; String key; @@ -555,15 +558,15 @@ public class LOGJSONObject { * @throws JSONException if the key is not found or * if the value is not a Number object and cannot be converted to a number. */ - public double getDouble(String key) throws JSONException { + public double getDouble(String key) { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); } catch (Exception e) { - throw new JSONException("JSONObject[" + quote(key) + - "] is not a number."); + intlogger.error("JSONObject[" + quote(key) + "] is not a number.", e); + throw new JSONException("JSONObject[" + quote(key) + "] is not a number."); } } @@ -576,15 +579,15 @@ public class LOGJSONObject { * @throws JSONException if the key is not found or if the value cannot * be converted to an integer. */ - public int getInt(String key) throws JSONException { + public int getInt(String key) { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { - throw new JSONException("JSONObject[" + quote(key) + - "] is not an int."); + intlogger.error("JSONObject[" + quote(key) + "] is not an int.", e); + throw new JSONException("JSONObject[" + quote(key) + "] is not an int."); } } @@ -640,8 +643,8 @@ public class LOGJSONObject { ? ((Number) object).longValue() : Long.parseLong((String) object); } catch (Exception e) { - throw new JSONException("JSONObject[" + quote(key) + - "] is not a long."); + intlogger.error("JSONObject[" + quote(key) + "] is not a long.", e); + throw new JSONException("JSONObject[" + quote(key) + "] is not a long."); } } @@ -697,7 +700,7 @@ public class LOGJSONObject { * @return A string which is the value. * @throws JSONException if there is no string value for the key. */ - public String getString(String key) throws JSONException { + public String getString(String key) { Object object = this.get(key); if (object instanceof String) { return (String) object; @@ -728,7 +731,7 @@ public class LOGJSONObject { * @throws JSONException If there is already a property with this name * that is not an Integer, Long, Double, or Float. */ - public LOGJSONObject increment(String key) throws JSONException { + public LOGJSONObject increment(String key) { Object value = this.opt(key); if (value == null) { this.put(key, 1); @@ -873,6 +876,7 @@ public class LOGJSONObject { try { return this.getBoolean(key); } catch (Exception e) { + intlogger.trace("Using defaultValue: " + defaultValue, e); return defaultValue; } } @@ -906,6 +910,7 @@ public class LOGJSONObject { try { return this.getDouble(key); } catch (Exception e) { + intlogger.trace("Using defaultValue: " + defaultValue, e); return defaultValue; } } @@ -939,6 +944,7 @@ public class LOGJSONObject { try { return this.getInt(key); } catch (Exception e) { + intlogger.trace("Using defaultValue: " + defaultValue, e); return defaultValue; } } @@ -1075,6 +1081,7 @@ public class LOGJSONObject { } } } catch (Exception ignore) { + intlogger.trace("populateMap: " + ignore.getMessage(), ignore); } } } @@ -1256,8 +1263,8 @@ public class LOGJSONObject { synchronized (sw.getBuffer()) { try { return quote(string, sw).toString(); - } catch (IOException ignored) { - // will never happen - we are writing to a string writer + } catch (IOException e) { + intlogger.trace("Ignore Exception message: ", e); return ""; } } @@ -1380,7 +1387,8 @@ public class LOGJSONObject { return myLong; } } - } catch (Exception ignore) { + } catch (Exception e) { + intlogger.trace("Ignore Exception message: ", e); } } return string; @@ -1393,7 +1401,7 @@ public class LOGJSONObject { * @param o The object to test. * @throws JSONException If o is a non-finite number. */ - public static void testValidity(Object o) throws JSONException { + public static void testValidity(Object o) { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { @@ -1446,6 +1454,7 @@ public class LOGJSONObject { try { return this.toString(0); } catch (Exception e) { + intlogger.trace("Exception: ", e); return ""; } } @@ -1579,6 +1588,7 @@ public class LOGJSONObject { } return new LOGJSONObject(object); } catch (Exception exception) { + intlogger.trace("Exception: ", exception); return null; } } diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java index 82231884..3ba1a151 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/LogfileLoader.java @@ -416,7 +416,7 @@ public class LogfileLoader extends Thread { }
} catch (SQLException e) {
logger.warn("PROV8003 Invalid value in record: " + line);
- logger.debug(e.toString());
+ logger.debug(e.toString(), e);
} catch (NumberFormatException e) {
logger.warn("PROV8004 Invalid number in record: " + line);
logger.debug(e.toString());
@@ -425,7 +425,7 @@ public class LogfileLoader extends Thread { logger.debug(e.toString());
} catch (Exception e) {
logger.warn("PROV8006 Invalid pattern in record: " + line);
- logger.debug(e.toString());
+ logger.debug(e.toString(), e);
}
total++;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java index f3e84b4a..8c67e71f 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/PurgeLogDirTask.java @@ -51,7 +51,7 @@ public class PurgeLogDirTask extends TimerTask { logdir = p.getProperty("org.onap.dmaap.datarouter.provserver.accesslog.dir");
String s = p.getProperty("org.onap.dmaap.datarouter.provserver.logretention", "30");
- this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");;
+ this.utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");
long n = 30;
try {
@@ -75,7 +75,7 @@ public class PurgeLogDirTask extends TimerTask { }
}
} catch (Exception e) {
- utilsLogger.error("Exception: " + e.getMessage());
+ utilsLogger.error("Exception: " + e.getMessage(), e);
}
}
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java index c9fb5a16..5c1fd560 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/ThrottleFilter.java @@ -138,7 +138,7 @@ public class ThrottleFilter extends TimerTask implements Filter { }
}
} catch (ClassNotFoundException e) {
- logger.warn("Class " + JETTY_REQUEST + " is not available; this filter requires Jetty.");
+ logger.warn("Class " + JETTY_REQUEST + " is not available; this filter requires Jetty.", e);
}
}
logger.info("ThrottleFilter is DISABLED for /publish requests.");
@@ -275,7 +275,7 @@ public class ThrottleFilter extends TimerTask implements Filter { t = times.get(0);
}
} catch (IndexOutOfBoundsException e) {
- // ignore
+ logger.trace("Exception: " + e.getMessage(), e);
}
return times.size();
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java index 0c6afdd7..ffed1a1b 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/URLUtilities.java @@ -24,6 +24,8 @@ package org.onap.dmaap.datarouter.provisioning.utils;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
@@ -37,7 +39,7 @@ import org.onap.dmaap.datarouter.provisioning.BaseServlet; * @version $Id: URLUtilities.java,v 1.2 2014/03/12 19:45:41 eby Exp $
*/
public class URLUtilities {
-
+ private static final EELFLogger utilsLogger = EELFManager.getInstance().getLogger("UtilsLog");
/**
* Generate the URL used to access a feed.
*
@@ -134,6 +136,7 @@ public class URLUtilities { this_pod = InetAddress.getLocalHost().getHostName();
System.out.println("this_pod: " + this_pod);
} catch (UnknownHostException e) {
+ utilsLogger.trace("UnkownHostException: " + e.getMessage(), e);
this_pod = "";
}
System.out.println("ALL PODS: " + Arrays.asList(BaseServlet.getPods()));
|