Adjust Logging Dir settings for ONAP Users

Issue-ID: AAF-360
Change-Id: If19090ef482372d3a3a9aa2856762af91bc54017
Signed-off-by: Instrumental <jonathan.gathman@att.com>
diff --git a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
index e295c86..e6f2fc9 100644
--- a/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
+++ b/auth/auth-core/src/main/java/org/onap/aaf/auth/server/Log4JLogIt.java
@@ -62,6 +62,9 @@
 			logs.mkdirs();
 		}
 
+		if(System.getProperty("log4j.configuration")==null) {
+			System.setProperty("log4j.configuration", etc_dir+'/'+propsFile);
+		}
 		LogFileNamer lfn = new LogFileNamer(log_dir,root);
 		try {
 			service=lfn.setAppender("service"); // when name is split, i.e. authz|service, the Appender is "authz", and "service"
diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
index 3d42b63..eefb273 100644
--- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
+++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java
@@ -21,7 +21,8 @@
  ******************************************************************************/
 package org.onap.aaf.org;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -160,7 +161,6 @@
 	@Override
 	public DefaultOrgIdentity getIdentity(AuthzTrans trans, String id) throws OrganizationException {
 		int at = id.indexOf('@');
-		String attt = at<0?id:id.substring(0, at);
 		return new DefaultOrgIdentity(trans,at<0?id:id.substring(0, at),this);
 	}
 
diff --git a/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/.gitignore b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/.gitignore
new file mode 100644
index 0000000..52448be
--- /dev/null
+++ b/cadi/aaf/src/test/java/org/onap/aaf/cadi/cm/test/.gitignore
@@ -0,0 +1 @@
+/JU_CmAgentCreate.java
diff --git a/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java b/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
index a98ba7c..c6537de 100644
--- a/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
+++ b/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
@@ -59,15 +59,14 @@
 	 * @throws IOException

 	 */

 	public String setAppender(String appender) throws IOException {

-		String filename;

 		int i = 0;

 		File f;

-		while ((f = new File(filename = String.format(FILE_FORMAT_STR, dir, root, appender, ending, i))).exists()) {

+		while ((f = new File(String.format(FILE_FORMAT_STR, dir, root, appender, ending, i))).exists()) {

 			++i;

 		}

-		;

+		

 		f.createNewFile();

-		System.setProperty("LOG4J_FILENAME_" + appender, filename);

+		System.setProperty("LOG4J_FILENAME_" + appender, f.getCanonicalPath());

 		return appender;

 	}

 

diff --git a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
index 0ee79a5..b96d6dd 100644
--- a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
+++ b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
@@ -34,6 +34,7 @@
 import org.junit.Test;

 

 public class JU_LogFileNamerTest {

+	private File dir = new File(".");

 

 	private String ending = new SimpleDateFormat("YYYYMMdd").format(new Date());

 

@@ -43,26 +44,26 @@
 

 	@Test

 	public void test() throws IOException {

-		LogFileNamer logFileNamer = new LogFileNamer(".", "log");

+		LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "log");

 		assertEquals(logFileNamer, logFileNamer.noPID());

 

 		logFileNamer.setAppender("Append");

-		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), "./log-Append" + ending + "_0.log");

+		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), dir.getCanonicalFile()+"/log-Append" + ending + "_0.log");

 

 		logFileNamer.setAppender("Append");

-		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), "./log-Append" + ending + "_1.log");

+		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), dir.getCanonicalFile()+"/log-Append" + ending + "_1.log");

 	}

 

 	@Test

 	public void testBlankRoot() throws IOException {

-		LogFileNamer logFileNamer = new LogFileNamer(".", "");

+		LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "");

 		assertEquals(logFileNamer, logFileNamer.noPID());

 

 		logFileNamer.setAppender("Append");

-		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), "./Append" + ending + "_0.log");

+		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), dir.getCanonicalPath()+"/Append" + ending + "_0.log");

 

 		logFileNamer.setAppender("Append");

-		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), "./Append" + ending + "_1.log");

+		assertEquals(System.getProperty("LOG4J_FILENAME_Append"), dir.getCanonicalPath()+"/Append" + ending + "_1.log");

 	}

 

 	@After