From abf7c0e407c97250c07d408c314c5aa1c757263e Mon Sep 17 00:00:00 2001 From: Instrumental Date: Tue, 3 Apr 2018 21:30:32 -0500 Subject: Create method of Logging to O/S from Container Issue-ID: AAF-211 Change-Id: Ib5c369c24082823f6f8cfde7609b966f57085665 Signed-off-by: Instrumental --- .../main/java/org/onap/aaf/auth/hello/AAF_Hello.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'auth/auth-hello') diff --git a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java index 97448bdd..b20bf168 100644 --- a/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java +++ b/auth/auth-hello/src/main/java/org/onap/aaf/auth/hello/AAF_Hello.java @@ -22,6 +22,7 @@ package org.onap.aaf.auth.hello; +import java.io.File; import java.util.Map; import javax.servlet.Filter; @@ -34,6 +35,7 @@ import org.onap.aaf.auth.rserv.HttpCode; import org.onap.aaf.auth.rserv.HttpMethods; import org.onap.aaf.auth.server.AbsService; import org.onap.aaf.auth.server.JettyServiceStarter; +import org.onap.aaf.auth.server.Log4JLogIt; import org.onap.aaf.cadi.CadiException; import org.onap.aaf.cadi.LocatorException; import org.onap.aaf.cadi.PropAccess; @@ -116,10 +118,21 @@ public class AAF_Hello extends AbsService { } public static void main(final String[] args) { - PropAccess propAccess = new PropAccess(args); try { + String propsFile = getArg(AAF_LOG4J_PREFIX, args, "org.osaaf")+".log4j.props"; + String log_dir = getArg(Config.CADI_LOGDIR,args,"./logs"); + String log_level = getArg(Config.CADI_LOGLEVEL,args,"INFO"); + File logs = new File(log_dir); + if(!logs.isDirectory()) { + logs.delete(); + } + if(!logs.exists()) { + logs.mkdirs(); + } + Log4JLogIt logIt = new Log4JLogIt(log_dir,log_level,propsFile, "hello"); + PropAccess propAccess = new PropAccess(logIt,args); + AAF_Hello service = new AAF_Hello(new AuthzEnv(propAccess)); -// env.setLog4JNames("log4j.properties","authz","hello","audit","init","trace"); JettyServiceStarter jss = new JettyServiceStarter(service); jss.start(); } catch (Exception e) { -- cgit 1.2.3-korg