X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-batch%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fbatch%2FBatch.java;h=d49f4faf1b14fdd8931081e7655ef4b40a7f7161;hb=12414fe43077e12d7ef711951b1633ad31d73573;hp=ff605203ea8e7e9ebfa33803cf455187ec34d78e;hpb=27e133b8f3f189bb41354d0624dcdb0998bd4701;p=aaf%2Fauthz.git diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java index ff605203..d49f4faf 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java @@ -81,6 +81,8 @@ public abstract class Batch { protected static boolean dryRun; protected static String batchEnv; + private static File logdir; + public static final String CASS_ENV = "CASS_ENV"; public static final String LOG_DIR = "LOG_DIR"; protected static final String MAX_EMAILS="MAX_EMAILS"; @@ -324,16 +326,22 @@ public abstract class Batch { } } - protected static String logDir() { - String ld = env.getProperty(LOG_DIR); - if (ld==null) { - if (batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir - ld = "logs/"; - } else { - ld = "logs/"+batchEnv; - } - } - return ld; + protected static File logDir() { + if(logdir == null) { + String ld = env.getProperty(LOG_DIR); + if (ld==null) { + if (batchEnv==null) { // Deployed Batch doesn't use different ENVs, and a common logdir + ld = "logs/"; + } else { + ld = "logs/"+batchEnv; + } + } + logdir = new File(ld); + if(!logdir.exists()) { + logdir.mkdirs(); + } + } + return logdir; } protected int count(String str, char c) { if (str==null || str.isEmpty()) {