X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fserver%2FLog4JLogIt.java;h=284a7dec877339ee2a04f4f5d729a72baddcdc54;hb=82755753f41112e1cdd91b2994620ad074dfbf20;hp=894f571d0c6ccd0ee14d0f4ce746ccef204b5f60;hpb=ff1417ff60baee231a28272f9a16ef2c9c8ea0a2;p=aaf%2Fauthz.git 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 894f571d..284a7dec 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 @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,7 +35,7 @@ import org.onap.aaf.misc.env.util.Chrono; public class Log4JLogIt implements LogIt { protected static final String AAF_LOG4J_PREFIX = "aaf_log4j_prefix"; // Log4j does it's own date. Can't apparently turn it off. - + private final String service; private final String audit; private final String init; @@ -49,10 +49,10 @@ public class Log4JLogIt implements LogIt { public Log4JLogIt(final String[] args, final String root) throws APIException { String propsFile = getArgOrVM(AAF_LOG4J_PREFIX, args, "org.osaaf.aaf")+".log4j.props"; - String log_dir = getArgOrVM(Config.CADI_LOGDIR,args,"/opt/app/osaaf/logs"); - String etc_dir = getArgOrVM(Config.CADI_ETCDIR,args,"/opt/app/osaaf/etc"); - String log_level = getArgOrVM(Config.CADI_LOGLEVEL,args,"INFO"); - File logs = new File(log_dir); + String logDir = getArgOrVM(Config.CADI_LOGDIR,args,"/opt/app/osaaf/logs"); + String etcDir = getArgOrVM(Config.CADI_ETCDIR,args,"/opt/app/osaaf/etc"); + String logLevel = getArgOrVM(Config.CADI_LOGLEVEL,args,"INFO"); + File logs = new File(logDir); if (!logs.isDirectory()) { logs.delete(); } @@ -61,9 +61,9 @@ public class Log4JLogIt implements LogIt { } if (System.getProperty("log4j.configuration")==null) { - System.setProperty("log4j.configuration", etc_dir+'/'+propsFile); + System.setProperty("log4j.configuration", etcDir+'/'+propsFile); } - LogFileNamer lfn = new LogFileNamer(log_dir,root); + LogFileNamer lfn = new LogFileNamer(logDir,root); try { service=lfn.setAppender("service"); // when name is split, i.e. authz|service, the Appender is "authz", and "service" audit=lfn.setAppender("audit"); // is part of the log-file name @@ -74,13 +74,13 @@ public class Log4JLogIt implements LogIt { laudit = Logger.getLogger(audit); linit = Logger.getLogger(init); ltrace = Logger.getLogger(trace); - - lfn.configure(etc_dir,propsFile, log_level); + + lfn.configure(etcDir,propsFile, logLevel); } catch (IOException e) { throw new APIException(e); } } - + private static final String getArgOrVM(final String tag, final String args[], final String def) { String tagEQ = tag + '='; String value; @@ -91,10 +91,10 @@ public class Log4JLogIt implements LogIt { } // check System.properties value = System.getProperty(tag); - if (value!=null) { + if (value!=null) { return value; } - + return def; } @@ -127,7 +127,7 @@ public class Log4JLogIt implements LogIt { default: lservice.info(PropAccess.buildMsg(service, Chrono.utcFmt, level, elements)); break; - + } }