X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cadi%2Fcore%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fcadi%2FPropAccess.java;h=26aa98cbceaf6b19d45388323fdbb1b68d47216a;hb=4a5f63f7f149ecba9556ee67a4ca00fb51845bf0;hp=fac6a3f1f5ac24604d42d39c81fac1d734825ba2;hpb=9f1388eb5ac3f9aab5fe617eae55b08fd2a57059;p=aaf%2Fauthz.git diff --git a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java index fac6a3f1..26aa98cb 100644 --- a/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java +++ b/cadi/core/src/main/java/org/onap/aaf/cadi/PropAccess.java @@ -21,12 +21,14 @@ package org.onap.aaf.cadi; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.io.PrintWriter; +import java.io.StringBufferInputStream; import java.io.StringWriter; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -108,7 +110,6 @@ public class PropAccess implements Access { protected synchronized void init(Properties p) { // Make sure these two are set before any changes in Logging name = "cadi"; - level=DEFAULT.maskOf(); props = new Properties(); // First, load related System Properties @@ -127,16 +128,14 @@ public class PropAccess implements Access { // Preset LogLevel String sLevel = props.getProperty(Config.CADI_LOGLEVEL); - if (sLevel!=null) { - level=Level.valueOf(sLevel).maskOf(); - } - // Third, load any Chained Property Files load(props.getProperty(Config.CADI_PROP_FILES)); if(sLevel==null) { // if LogLev wasn't set before, check again after Chained Load sLevel = props.getProperty(Config.CADI_LOGLEVEL); - if (sLevel!=null) { + if (sLevel==null) { + level=DEFAULT.maskOf(); + } else { level=Level.valueOf(sLevel).maskOf(); } } @@ -306,6 +305,11 @@ public class PropAccess implements Access { if (o!=null) { if(o.getClass().isArray()) { first = write(first,sb,(Object[])o); + } else if(o instanceof Throwable) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(baos); + ((Throwable)o).printStackTrace(ps); + sb.append(baos.toString()); } else { s=o.toString(); if (first) {