diff options
author | Ajith Sreekumar <ajith.sreekumar@bell.ca> | 2021-08-09 12:50:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-08-09 12:50:31 +0000 |
commit | 8a2f14ae90528454c4aa2351f8f4c1e04eaed2b6 (patch) | |
tree | ed0435840f311deb55b5744a64fcb1b4fde78a9d /runtime/src/main | |
parent | 522f98830955eeef3a2e602b855d2af01bafe941 (diff) | |
parent | 4aa0eb0bae6353408e9a82d8f07af1703ccaf9d3 (diff) |
Merge "Use slf4j instead of EELFLogger in Clamp"
Diffstat (limited to 'runtime/src/main')
37 files changed, 207 insertions, 263 deletions
diff --git a/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java b/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java index 89be4fc28..5fefc6d79 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java +++ b/runtime/src/main/java/org/onap/policy/clamp/authorization/AuthorizationController.java @@ -25,14 +25,15 @@ package org.onap.policy.clamp.authorization; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.util.Date; import org.apache.camel.Exchange; import org.onap.policy.clamp.clds.config.ClampProperties; import org.onap.policy.clamp.clds.exception.NotAuthorizedException; import org.onap.policy.clamp.clds.model.ClampInformation; import org.onap.policy.clamp.clds.util.LoggingUtils; +import org.onap.policy.common.utils.logging.LoggerUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; @@ -47,10 +48,7 @@ import org.springframework.stereotype.Component; @Component public class AuthorizationController { - protected static final EELFLogger logger = - EELFManager.getInstance().getLogger(AuthorizationController.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - protected static final EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger(); + protected static final Logger logger = LoggerFactory.getLogger(AuthorizationController.class); // By default we'll set it to a default handler @Autowired @@ -106,12 +104,12 @@ public class AuthorizationController { Date startTime = new Date(); LoggingUtils.setTargetContext("Clamp", "authorize"); LoggingUtils.setTimeContext(startTime, new Date()); - securityLogger.debug("checking if {} has permission: {}", principalName, perm); + logger.debug(LoggerUtils.SECURITY_LOG_MARKER, "checking if {} has permission: {}", principalName, perm); if (!isUserPermitted(perm)) { String msg = principalName + " does not have permission: " + perm; LoggingUtils.setErrorContext("100", "Authorization Error"); - securityLogger.warn(msg); + logger.warn(LoggerUtils.SECURITY_LOG_MARKER, msg); throw new NotAuthorizedException(msg); } } @@ -128,18 +126,20 @@ public class AuthorizationController { // check if the user has the permission key or the permission key with a // combination of all instance and/or all action. if (hasRole(inPermission.getKey()) || hasRole(inPermission.getKeyAllInstance())) { - auditLogger.info("{} authorized because user has permission with * for instance: {}", + logger.info(LoggerUtils.AUDIT_LOG_MARKER, + "{} authorized because user has permission with * for instance: {}", principalName, inPermission.getKey().replace("|", ":")); return true; // the rest of these don't seem to be required - isUserInRole method // appears to take * as a wildcard } else if (hasRole(inPermission.getKeyAllInstanceAction())) { - auditLogger.info( + logger.info(LoggerUtils.AUDIT_LOG_MARKER, "{} authorized because user has permission with * for instance and * for action: {}", principalName, inPermission.getKey().replace("|", ":")); return true; } else if (hasRole(inPermission.getKeyAllAction())) { - auditLogger.info("{} authorized because user has permission with * for action: {}", + logger.info(LoggerUtils.AUDIT_LOG_MARKER, + "{} authorized because user has permission with * for action: {}", principalName, inPermission.getKey().replace("|", ":")); return true; } else { diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java index aad678bf7..8b0056c0a 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/Application.java @@ -25,8 +25,6 @@ package org.onap.policy.clamp.clds; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.security.KeyStore; import java.security.KeyStoreException; @@ -39,6 +37,8 @@ import org.apache.catalina.connector.Connector; import org.onap.policy.clamp.clds.util.ClampVersioning; import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.onap.policy.clamp.util.PassDecoder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -71,7 +71,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableJpaAuditing public class Application extends SpringBootServletInitializer { - protected static final EELFLogger eelfLogger = EELFManager.getInstance().getLogger(Application.class); + protected static final Logger logger = LoggerFactory.getLogger(Application.class); // This settings is an additional one to Spring config, // only if we want to have an additional port automatically redirected to // HTTPS @@ -120,9 +120,9 @@ public class Application extends SpringBootServletInitializer { */ @Bean public ServletRegistrationBean<ClampServlet> camelServletRegistrationBean() throws IOException { - eelfLogger.info(ResourceFileUtils.getResourceAsString("boot-message.txt") + "(v" - + ClampVersioning.getCldsVersionFromProps() + ")" + System.getProperty("line.separator") - + getSslExpirationDate()); + logger.info("{} (v {} ), {}, {}", ResourceFileUtils.getResourceAsString("boot-message.txt"), + ClampVersioning.getCldsVersionFromProps(), System.getProperty("line.separator"), + getSslExpirationDate()); var registration = new ServletRegistrationBean<ClampServlet>(new ClampServlet(), "/restservices/clds/*"); registration.setName("CamelServlet"); return registration; @@ -149,8 +149,9 @@ public class Application extends SpringBootServletInitializer { private Connector createRedirectConnector(int redirectSecuredPort) { if (redirectSecuredPort <= 0) { - eelfLogger.warn("HTTP port redirection to HTTPS is disabled because the HTTPS port is 0 (random port) or -1" - + " (Connector disabled)"); + logger.warn( + "HTTP port redirection to HTTPS is disabled because the HTTPS" + + " port is 0 (random port) or -1 (Connector disabled)"); return null; } var connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); @@ -182,7 +183,7 @@ public class Application extends SpringBootServletInitializer { result.append("* NONE HAS been configured"); } } catch (CertificateException | NoSuchAlgorithmException | KeyStoreException e) { - eelfLogger.warn("SSL certificate access error ", e); + logger.warn("SSL certificate access error", e); } return result.toString(); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java b/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java index ccde7cf11..428f02a93 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/ClampServlet.java @@ -25,8 +25,6 @@ package org.onap.policy.clamp.clds; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.security.Principal; import java.util.ArrayList; @@ -40,6 +38,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.apache.commons.lang3.StringUtils; import org.onap.policy.clamp.authorization.SecureServicePermission; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -58,7 +58,7 @@ public class ClampServlet extends CamelHttpTransportServlet { */ private static final long serialVersionUID = -4198841134910211542L; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(ClampServlet.class); + private static final Logger logger = LoggerFactory.getLogger(ClampServlet.class); private static final String PERM_INSTANCE = "clamp.config.security.permission.instance"; private static final String PERM_CL = "clamp.config.security.permission.type.cl"; private static final String PERM_TEMPLATE = "clamp.config.security.permission.type.template"; diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java b/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java index cb74ad9e4..cc15f0f9e 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/client/CdsServices.java @@ -26,8 +26,6 @@ package org.onap.policy.clamp.clds.client; import static java.lang.Boolean.parseBoolean; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -42,6 +40,8 @@ import org.onap.policy.clamp.clds.exception.cds.CdsParametersException; import org.onap.policy.clamp.clds.model.cds.CdsBpWorkFlowListResponse; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.clds.util.LoggingUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; @@ -55,7 +55,7 @@ public class CdsServices { @Autowired CamelContext camelContext; - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CdsServices.class); + protected static final Logger logger = LoggerFactory.getLogger(CdsServices.class); private static final String TYPE = "type"; private static final String PROPERTIES = "properties"; @@ -81,7 +81,7 @@ public class CdsServices { if (HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE)) .is2xxSuccessful()) { String cdsResponse = (String) exchangeResponse.getIn().getBody(); - logger.info("getBlueprintWorkflowList, response from CDS:" + cdsResponse); + logger.info("getBlueprintWorkflowList, response from CDS: {}", cdsResponse); LoggingUtils.setResponseContext("0", "Get Blueprint workflow list", this.getClass().getName()); Date startTime = new Date(); LoggingUtils.setTimeContext(startTime, new Date()); @@ -115,7 +115,7 @@ public class CdsServices { if (HttpStatus.valueOf((Integer) exchangeResponse.getIn().getHeader(Exchange.HTTP_RESPONSE_CODE)) .is2xxSuccessful()) { String cdsResponse = (String) exchangeResponse.getIn().getBody(); - logger.info("getWorkflowInputProperties, response from CDS:" + cdsResponse); + logger.info("getWorkflowInputProperties, response from CDS: {}", cdsResponse); LoggingUtils .setResponseContext("0", "Get Blueprint workflow input properties", this.getClass().getName()); Date startTime = new Date(); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java b/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java index 843107040..af9c1b57b 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/client/DcaeInventoryServices.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.clds.client; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.util.Date; import org.apache.camel.CamelContext; @@ -40,6 +38,9 @@ import org.onap.policy.clamp.clds.config.ClampProperties; import org.onap.policy.clamp.clds.model.dcae.DcaeInventoryResponse; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.clds.util.LoggingUtils; +import org.onap.policy.common.utils.logging.LoggerUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; @@ -53,9 +54,8 @@ public class DcaeInventoryServices { @Autowired CamelContext camelContext; - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeInventoryServices.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + protected static final Logger logger = LoggerFactory.getLogger(DcaeInventoryServices.class); + public static final String DCAE_INVENTORY_URL = "dcae.inventory.url"; public static final String DCAE_INVENTORY_RETRY_INTERVAL = "dcae.intentory.retry.interval"; public static final String DCAE_INVENTORY_RETRY_LIMIT = "dcae.intentory.retry.limit"; @@ -109,7 +109,7 @@ public class DcaeInventoryServices { retryInterval = Integer.valueOf(refProp.getStringValue(DCAE_INVENTORY_RETRY_INTERVAL)); } for (int i = 0; i < retryLimit; i++) { - metricsLogger.info("Attempt n°" + i + " to contact DCAE inventory"); + logger.info(LoggerUtils.METRIC_LOG_MARKER, "Attempt n° {} to contact DCAE inventory", i); try (ProducerTemplate producerTemplate = camelContext.createProducerTemplate()) { Exchange exchangeResponse = producerTemplate .send("direct:get-dcae-blueprint-inventory", ExchangeBuilder.anExchange(camelContext) @@ -122,23 +122,24 @@ public class DcaeInventoryServices { .is2xxSuccessful()) { String dcaeResponse = (String) exchangeResponse.getIn().getBody(); int totalCount = getTotalCountFromDcaeInventoryResponse(dcaeResponse); - metricsLogger.info("getDcaeInformation complete: totalCount returned=" + totalCount); + logger.info(LoggerUtils.METRIC_LOG_MARKER, + "getDcaeInformation complete: totalCount returned= {}", totalCount); if (totalCount > 0) { - logger.info("getDcaeInformation, answer from DCAE inventory:" + dcaeResponse); + logger.info("getDcaeInformation, answer from DCAE inventory: {}", dcaeResponse); LoggingUtils.setResponseContext("0", "Get Dcae Information success", this.getClass().getName()); Date startTime = new Date(); LoggingUtils.setTimeContext(startTime, new Date()); return getItemsFromDcaeInventoryResponse(dcaeResponse); } else { - logger.info("Dcae inventory totalCount returned is 0, so waiting " + retryInterval - + "ms before retrying ..."); + logger.info("Dcae inventory totalCount returned is 0, so waiting {} ms before retrying ...", + retryInterval); // wait for a while and try to connect to DCAE again Thread.sleep(retryInterval); } } } } - logger.warn("Dcae inventory totalCount returned is still 0, after " + retryLimit + " attempts, returning NULL"); + logger.warn("Dcae inventory totalCount returned is still 0, after {} attempts, returning NULL", retryLimit); return null; } } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/DefaultUserConfiguration.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/DefaultUserConfiguration.java index bb7b76af3..136ed3c0a 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/DefaultUserConfiguration.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/DefaultUserConfiguration.java @@ -25,12 +25,12 @@ package org.onap.policy.clamp.clds.config; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import org.onap.policy.clamp.authorization.CldsUser; import org.onap.policy.clamp.clds.exception.CldsConfigException; import org.onap.policy.clamp.clds.exception.CldsUsersException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; @@ -52,7 +52,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; @Profile("clamp-default-user") public class DefaultUserConfiguration extends WebSecurityConfigurerAdapter { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DefaultUserConfiguration.class); + protected static final Logger logger = LoggerFactory.getLogger(DefaultUserConfiguration.class); private static final String SETUP_WEB_USERS_EXCEPTION_MSG = "Exception occurred during the " + " setup of the Web users in memory"; diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/SystemPropertiesLoader.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/SystemPropertiesLoader.java index 3e2e62b66..f86b093c8 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/SystemPropertiesLoader.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/SystemPropertiesLoader.java @@ -23,24 +23,24 @@ package org.onap.policy.clamp.clds.config; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.util.Properties; import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationListener; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.stereotype.Component; @Component public class SystemPropertiesLoader implements ApplicationListener<ContextRefreshedEvent> { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SystemPropertiesLoader.class); + protected static final Logger logger = LoggerFactory.getLogger(SystemPropertiesLoader.class); @Resource(name = "mapper") private Properties myTranslator; @Override public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { - logger.info("Loading additional JVM properties:" + myTranslator.toString()); + logger.info("Loading additional JVM properties: {}", myTranslator); System.getProperties().putAll(myTranslator); } } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/config/spring/SdcControllerConfiguration.java b/runtime/src/main/java/org/onap/policy/clamp/clds/config/spring/SdcControllerConfiguration.java index 6005b0d39..f2a0d70d8 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/config/spring/SdcControllerConfiguration.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/config/spring/SdcControllerConfiguration.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.config.spring; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; @@ -35,6 +33,8 @@ import org.onap.policy.clamp.clds.exception.sdc.controller.SdcControllerExceptio import org.onap.policy.clamp.clds.sdc.controller.SdcSingleController; import org.onap.policy.clamp.clds.sdc.controller.SdcSingleControllerStatus; import org.onap.policy.clamp.loop.CsarInstaller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; @@ -46,7 +46,7 @@ import org.springframework.scheduling.annotation.Scheduled; @Profile("clamp-sdc-controller") public class SdcControllerConfiguration { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcControllerConfiguration.class); + private static final Logger logger = LoggerFactory.getLogger(SdcControllerConfiguration.class); private List<SdcSingleController> sdcControllersList = new ArrayList<>(); private final ClampProperties clampProp; private final CsarInstaller csarInstaller; @@ -65,7 +65,7 @@ public class SdcControllerConfiguration { public void loadSdcControllers() { SdcControllersConfiguration sdcControllersConfig = getSdcControllersConfiguration(); sdcControllersConfig.getAllDefinedControllers().forEach((key, value) -> { - logger.info("Creating controller instance:" + key); + logger.info("Creating controller instance: {}", key); SdcSingleController sdcController = new SdcSingleController(clampProp, csarInstaller, value, null); sdcControllersList.add(sdcController); }); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java b/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java index 6fa8ecb2b..2c3c95885 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/filter/ClampCadiFilter.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.filter; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; @@ -44,12 +42,14 @@ import javax.servlet.http.HttpServletRequest; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.cadi.filter.CadiFilter; import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; public class ClampCadiFilter extends CadiFilter { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(ClampCadiFilter.class); + private static final Logger logger = LoggerFactory.getLogger(ClampCadiFilter.class); @Autowired private ApplicationContext appContext; diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/SdcSingleController.java b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/SdcSingleController.java index 39e64e46b..317929268 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/SdcSingleController.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/SdcSingleController.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.clds.sdc.controller; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.security.SecureRandom; import java.util.Date; import java.util.Map.Entry; @@ -52,13 +50,15 @@ import org.onap.sdc.impl.DistributionClientFactory; import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.onap.sdc.utils.DistributionActionResultEnum; import org.onap.sdc.utils.DistributionStatusEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class handles one sdc controller defined in the config. */ public class SdcSingleController { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcSingleController.class); + private static final Logger logger = LoggerFactory.getLogger(SdcSingleController.class); private boolean isSdcClientAutoManaged = false; private CsarInstaller csarInstaller; private ClampProperties refProp; @@ -94,8 +94,8 @@ public class SdcSingleController { @Override public void activateCallback(INotificationData notificationData) { Date startTime = new Date(); - logger.info("Receive a callback notification in SDC, nb of resources: " - + notificationData.getResources().size()); + logger.info("Receive a callback notification in SDC, nb of resources: {}", + notificationData.getResources().size()); sdcController.treatNotification(notificationData); LoggingUtils.setTimeContext(startTime, new Date()); LoggingUtils.setResponseContext("0", "SDC Notification received and processed successfully", @@ -176,7 +176,7 @@ public class SdcSingleController { * is done when already initialized */ public void initSdc() throws SdcControllerException { - logger.info("Attempt to initialize the SDC Controller: " + sdcConfig.getSdcControllerName()); + logger.info("Attempt to initialize the SDC Controller: {}", sdcConfig.getSdcControllerName()); if (this.getControllerStatus() != SdcSingleControllerStatus.STOPPED) { throw new SdcControllerException("The controller is already initialized, call the closeSDC method first"); } @@ -185,13 +185,13 @@ public class SdcSingleController { } IDistributionClientResult result = distributionClient.init(sdcConfig, new SdcNotificationCallBack(this)); if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { - logger.error("SDC distribution client init failed with reason:" + result.getDistributionMessageResult()); + logger.error("SDC distribution client init failed with reason: {}", result.getDistributionMessageResult()); this.changeControllerStatus(SdcSingleControllerStatus.STOPPED); throw new SdcControllerException("Initialization of the SDC Controller failed with reason: " + result.getDistributionMessageResult()); } - logger.info("SDC Controller successfully initialized: " + sdcConfig.getSdcControllerName()); - logger.info("Attempt to start the SDC Controller: " + sdcConfig.getSdcControllerName()); + logger.info("SDC Controller successfully initialized: {}", sdcConfig.getSdcControllerName()); + logger.info("Attempt to start the SDC Controller: {}", sdcConfig.getSdcControllerName()); result = this.distributionClient.start(); if (!result.getDistributionActionResult().equals(DistributionActionResultEnum.SUCCESS)) { logger.error("SDC distribution client start failed with reason:" + result.getDistributionMessageResult()); @@ -199,7 +199,7 @@ public class SdcSingleController { throw new SdcControllerException( "Startup of the SDC Controller failed with reason: " + result.getDistributionMessageResult()); } - logger.info("SDC Controller successfully started: " + sdcConfig.getSdcControllerName()); + logger.info("SDC Controller successfully started: {}", sdcConfig.getSdcControllerName()); this.changeControllerStatus(SdcSingleControllerStatus.IDLE); } @@ -262,7 +262,7 @@ public class SdcSingleController { // wait for a random time, so that 2 running Clamp will not treat // the same Notification at the same time Thread.sleep((new SecureRandom().nextInt(10) + 1) * 1000L); - logger.info("Notification received for service UUID:" + notificationData.getServiceUUID()); + logger.info("Notification received for service UUID: {}", notificationData.getServiceUUID()); this.changeControllerStatus(SdcSingleControllerStatus.BUSY); csar = new CsarHandler(notificationData, this.sdcConfig.getSdcControllerName(), refProp.getStringValue(CONFIG_SDC_FOLDER)); @@ -323,8 +323,8 @@ public class SdcSingleController { } private IDistributionClientDownloadResult downloadTheArtifact(IArtifactInfo artifact) throws SdcDownloadException { - logger.info("Trying to download the artifact : " + artifact.getArtifactURL() + " UUID: " - + artifact.getArtifactUUID()); + logger.info("Trying to download the artifact : {} UUID: {}", + artifact.getArtifactURL(), artifact.getArtifactUUID()); IDistributionClientDownloadResult downloadResult; try { downloadResult = distributionClient.download(artifact); @@ -336,8 +336,8 @@ public class SdcSingleController { throw new SdcDownloadException("Exception caught when downloading the artifact", e); } if (DistributionActionResultEnum.SUCCESS.equals(downloadResult.getDistributionActionResult())) { - logger.info("Successfully downloaded the artifact " + artifact.getArtifactURL() + " UUID " - + artifact.getArtifactUUID() + "Size of payload " + downloadResult.getArtifactPayload().length); + logger.info("Successfully downloaded the artifact {} UUID {} Size of payload {}", artifact.getArtifactURL(), + artifact.getArtifactUUID(), downloadResult.getArtifactPayload().length); } else { throw new SdcDownloadException("Artifact " + artifact.getArtifactName() + " could not be downloaded from SDC URL " + artifact.getArtifactURL() + " UUID " @@ -373,9 +373,9 @@ public class SdcSingleController { break; } } catch (RuntimeException e) { - logger.warn("Unable to send the SDC Notification (" + action + ") due to an exception", e); + logger.warn("Unable to send the SDC Notification ({}) due to an exception", action, e); } - logger.info("SDC Notification sent successfully(" + action + ")"); + logger.info("SDC Notification sent successfully ({})", action); } private void sendComponentStatus(INotificationData notificationData, DistributionStatusEnum status, @@ -415,9 +415,9 @@ public class SdcSingleController { this.distributionClient.sendComponentDoneStatus(message); } } catch (RuntimeException e) { - logger.warn("Unable to send the SDC Notification (" + status.name() + ") due to an exception", e); + logger.warn("Unable to send the SDC Notification ({}) due to an exception", status.name(), e); } - logger.info("SDC Notification sent successfully(" + status.name() + ")"); + logger.info("SDC Notification sent successfully ({})", status.name()); } private void sendDownloadStatus(IDistributionStatusMessage message, String errorReason) { diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParser.java b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParser.java index ada47992a..970c862d1 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParser.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/BlueprintParser.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.clds.sdc.controller.installer; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -39,6 +37,8 @@ import java.util.Map.Entry; import java.util.Set; import org.json.JSONObject; import org.onap.policy.clamp.clds.exception.sdc.controller.BlueprintParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; public class BlueprintParser { @@ -59,7 +59,7 @@ public class BlueprintParser { private static final String TARGET = "target"; public static final String DEFAULT_VERSION = "1.0.0"; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(BlueprintParser.class); + private static final Logger logger = LoggerFactory.getLogger(BlueprintParser.class); private BlueprintParser() { @@ -86,12 +86,14 @@ public class BlueprintParser { if (!microService.getModelType().isBlank()) { microServices.add(microService); } else { - logger.warn("Microservice " + microService.getName() - + " will NOT be used by CLAMP as the model type is not defined or has not been found"); + logger.warn( + "Microservice {} will NOT be used by CLAMP as the model" + + "type is not defined or has not been found", + microService.getName()); } } } - logger.debug("Those microservices have been found in the blueprint:" + microServices); + logger.debug("Those microservices have been found in the blueprint: {}", microServices); return microServices; } @@ -195,11 +197,11 @@ public class BlueprintParser { String versionFound = getPropertyValue(POLICY_MODEL_VERSION, nodeTemplateEntry, blueprintNodeTemplateList, blueprintInputList); if (modelIdFound.isBlank()) { - logger.warn("policy_model_id is not defined for the node template:" + nodeTemplateEntry.getKey()); + logger.warn("policy_model_id is not defined for the node template: {}", nodeTemplateEntry.getKey()); } if (versionFound.isBlank()) { - logger.warn("policy_model_version is not defined (setting it to a default value) for the node template:" - + nodeTemplateEntry.getKey()); + logger.warn("policy_model_version is not defined (setting it to a default value) for the node template: {}", + nodeTemplateEntry.getKey()); } return new BlueprintMicroService(getName(nodeTemplateEntry), modelIdFound, getInput(nodeTemplateEntry), !versionFound.isBlank() ? versionFound : DEFAULT_VERSION); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java index 436e594ce..6591be422 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/sdc/controller/installer/CsarHandler.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.sdc.controller.installer; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -50,6 +48,8 @@ import org.onap.sdc.api.results.IDistributionClientDownloadResult; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * CsarDescriptor that will be used to deploy file in CLAMP file system. Some @@ -57,7 +57,7 @@ import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; */ public class CsarHandler { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarHandler.class); + private static final Logger logger = LoggerFactory.getLogger(CsarHandler.class); private IArtifactInfo artifactElement; private String csarFilePath; private String controllerName; @@ -108,7 +108,7 @@ public class CsarHandler { public synchronized void save(IDistributionClientDownloadResult resultArtifact) throws SdcArtifactInstallerException, SdcToscaParserException { try { - logger.info("Writing CSAR file to: " + csarFilePath + " UUID " + artifactElement.getArtifactUUID() + ")"); + logger.info("Writing CSAR file to: {} UUID {}", csarFilePath, artifactElement.getArtifactUUID()); Path path = Paths.get(csarFilePath); Files.createDirectories(path.getParent()); // Create or replace the file @@ -155,12 +155,12 @@ public class CsarHandler { + RESOURCE_INSTANCE_NAME_PREFIX.length(), entry.getName().indexOf(RESOURCE_INSTANCE_NAME_SUFFIX)))); this.mapOfBlueprints.put(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact); - logger.info("Found a blueprint entry in the CSAR " + blueprintArtifact.getBlueprintArtifactName() - + " for resource instance Name " - + blueprintArtifact.getResourceAttached().getResourceInstanceName()); + logger.info("Found a blueprint entry in the CSAR {} for resource instance Name {}", + blueprintArtifact.getBlueprintArtifactName(), + blueprintArtifact.getResourceAttached().getResourceInstanceName()); } } - logger.info(this.mapOfBlueprints.size() + " blueprint(s) will be converted to closed loop"); + logger.info("{} blueprint(s) will be converted to closed loop", this.mapOfBlueprints.size()); } } @@ -211,7 +211,7 @@ public class CsarHandler { result = IOUtils.toString(zipFile.getInputStream(entry), StandardCharsets.UTF_8); } } else { - logger.info("Policy model not found inside the CSAR file: " + csarFilePath); + logger.info("Policy model not found inside the CSAR file: {}", csarFilePath); } return Optional.ofNullable(result); } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java index 6702a6200..5834586c2 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/ToscaConverterWithDictionarySupport.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.tosca.update; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import java.io.IOException; import org.onap.policy.clamp.clds.config.ClampProperties; @@ -33,6 +31,8 @@ import org.onap.policy.clamp.clds.tosca.update.parser.metadata.ToscaMetadataPars import org.onap.policy.clamp.clds.tosca.update.templates.JsonTemplateManager; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.loop.service.Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -46,8 +46,8 @@ import org.springframework.stereotype.Component; @Component public class ToscaConverterWithDictionarySupport { - private static final EELFLogger logger = - EELFManager.getInstance().getLogger(ToscaConverterWithDictionarySupport.class); + private static final Logger logger = + LoggerFactory.getLogger(ToscaConverterWithDictionarySupport.class); private ClampProperties clampProperties; private ToscaMetadataParser metadataParser; diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java index 5fac9a213..2532295d0 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataExecutor.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.tosca.update.execution; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import java.util.HashMap; import java.util.Map; @@ -32,6 +30,8 @@ import javax.annotation.PostConstruct; import org.onap.policy.clamp.clds.tosca.update.execution.cds.ToscaMetadataCdsProcess; import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.tosca.DictionaryService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -41,8 +41,8 @@ import org.springframework.stereotype.Component; @Component public class ToscaMetadataExecutor { - private static final EELFLogger logger = - EELFManager.getInstance().getLogger(ToscaMetadataExecutor.class); + private static final Logger logger = + LoggerFactory.getLogger(ToscaMetadataExecutor.class); @Autowired private DictionaryService dictionaryService; @@ -58,8 +58,8 @@ public class ToscaMetadataExecutor { */ public void executeTheProcess(String processInfo, JsonObject childObject, Service serviceModel) { String[] processParameters = (processInfo + "/ ").split("/"); - logger.info("Executing the Tosca clamp process " + processParameters[0] + " with parameters " - + processParameters[1].trim()); + logger.info("Executing the Tosca clamp process {} with parameters {}", + processParameters[0], processParameters[1].trim()); mapOfProcesses.get(processParameters[0].trim()) .executeProcess(processParameters[1].trim(), childObject, serviceModel); } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataTargetProcess.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataTargetProcess.java index 0ffd86f47..0541a4696 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataTargetProcess.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/ToscaMetadataTargetProcess.java @@ -23,11 +23,11 @@ package org.onap.policy.clamp.clds.tosca.update.execution; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.policy.operational.OperationalPolicyRepresentationBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class is there to add the JsonObject for CDS in the json Schema according to what is found in the Tosca model. @@ -35,8 +35,8 @@ import org.onap.policy.clamp.policy.operational.OperationalPolicyRepresentationB public class ToscaMetadataTargetProcess extends ToscaMetadataProcess { - private static final EELFLogger logger = - EELFManager.getInstance().getLogger(ToscaMetadataTargetProcess.class); + private static final Logger logger = + LoggerFactory.getLogger(ToscaMetadataTargetProcess.class); @Override public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) { diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java index c80c91170..8ecdc1900 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.tosca.update.execution.cds; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -33,6 +31,8 @@ import java.util.Set; import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants; import org.onap.policy.clamp.clds.tosca.update.execution.ToscaMetadataProcess; import org.onap.policy.clamp.loop.service.Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -40,8 +40,8 @@ import org.onap.policy.clamp.loop.service.Service; */ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess { - private static final EELFLogger logger = - EELFManager.getInstance().getLogger(ToscaMetadataCdsProcess.class); + private static final Logger logger = + LoggerFactory.getLogger(ToscaMetadataCdsProcess.class); @Override public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) { diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/util/ClampVersioning.java b/runtime/src/main/java/org/onap/policy/clamp/clds/util/ClampVersioning.java index 0890615d9..3cfbc394a 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/util/ClampVersioning.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/util/ClampVersioning.java @@ -24,10 +24,10 @@ package org.onap.policy.clamp.clds.util; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.InputStream; import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class give a way to know the Clamp version easily, the version in that @@ -37,7 +37,7 @@ import java.util.Properties; public class ClampVersioning { private static final String RESOURCE_NAME = "clds-version.properties"; private static final String CLDS_VERSION_PROPERTY = "clds.version"; - private static final EELFLogger LOGGER = EELFManager.getInstance().getLogger(ClampVersioning.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ClampVersioning.class); private ClampVersioning() { } diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java b/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java index fd5079c47..909b240fb 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java +++ b/runtime/src/main/java/org/onap/policy/clamp/clds/util/JsonUtils.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.clds.util; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.time.Instant; @@ -32,13 +30,15 @@ import org.onap.policy.clamp.authorization.SecureServicePermission; import org.onap.policy.clamp.authorization.SecureServicePermissionDeserializer; import org.onap.policy.clamp.dao.model.gson.converter.InstantDeserializer; import org.onap.policy.clamp.dao.model.gson.converter.InstantSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class is used to access the GSON with restricted type access. */ public class JsonUtils { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(JsonUtils.class); + protected static final Logger logger = LoggerFactory.getLogger(JsonUtils.class); public static final Gson GSON = new GsonBuilder().setPrettyPrinting() .registerTypeAdapter(SecureServicePermission.class, new SecureServicePermissionDeserializer()).create(); diff --git a/runtime/src/main/java/org/onap/policy/clamp/clds/util/LogMessages.java b/runtime/src/main/java/org/onap/policy/clamp/clds/util/LogMessages.java deleted file mode 100644 index 676206e0f..000000000 --- a/runtime/src/main/java/org/onap/policy/clamp/clds/util/LogMessages.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights - * reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * =================================================================== - * - */ - -package org.onap.policy.clamp.clds.util; - -import com.att.eelf.i18n.EELFResolvableErrorEnum; -import com.att.eelf.i18n.EELFResourceManager; - -public enum LogMessages implements EELFResolvableErrorEnum { - LOGSERVICE_HELLO_MESSAGE, LOGSERVICE_EMAIL_ERROR, LOGSERVICE_EMAIL_CLASS, LOGSERVICE_EMAIL_CLASS_NULL, - PROCESS_INSTANCE_ID; - - static { - EELFResourceManager.loadMessageBundle("logmessages"); - } -} diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java b/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java index 2da1c0553..aefe4556d 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/CsarInstaller.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.loop; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.util.HashSet; import java.util.List; @@ -47,6 +45,8 @@ import org.onap.policy.clamp.loop.template.LoopTemplate; import org.onap.policy.clamp.loop.template.LoopTemplatesRepository; import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.onap.policy.clamp.policy.PolicyEngineServices; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @@ -60,7 +60,7 @@ import org.springframework.stereotype.Component; @Qualifier("csarInstaller") public class CsarInstaller { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarInstaller.class); + private static final Logger logger = LoggerFactory.getLogger(CsarInstaller.class); @Autowired private PolicyModelsRepository policyModelsRepository; @@ -114,12 +114,12 @@ public class CsarInstaller { */ public void installTheCsar(CsarHandler csar) throws SdcArtifactInstallerException, InterruptedException, BlueprintParserException { - logger.info("Installing the CSAR " + csar.getFilePath()); + logger.info("Installing the CSAR {}", csar.getFilePath()); var associatedService = csarServiceInstaller.installTheService(csar); cdsDataInstaller.installCdsServiceProperties(csar, associatedService); installTheLoopTemplates(csar, associatedService); - logger.info("Successfully installed the CSAR " + csar.getFilePath()); + logger.info("Successfully installed the CSAR {}", csar.getFilePath()); } /** @@ -137,7 +137,7 @@ public class CsarInstaller { try { logger.info("Installing the Loops"); for (Entry<String, BlueprintArtifact> blueprint : csar.getMapOfBlueprints().entrySet()) { - logger.info("Processing blueprint " + blueprint.getValue().getBlueprintArtifactName()); + logger.info("Processing blueprint {}", blueprint.getValue().getBlueprintArtifactName()); loopTemplatesRepository.save(createLoopTemplateFromBlueprint(csar, blueprint.getValue(), service)); } logger.info("Successfully installed the Loops "); diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/cds/CdsDataInstaller.java b/runtime/src/main/java/org/onap/policy/clamp/loop/cds/CdsDataInstaller.java index 68adb3887..432659ab6 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/cds/CdsDataInstaller.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/cds/CdsDataInstaller.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.loop.cds; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import org.onap.policy.clamp.clds.client.CdsServices; import org.onap.policy.clamp.clds.model.cds.CdsBpWorkFlowListResponse; @@ -34,6 +32,8 @@ import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.loop.service.ServicesRepository; import org.onap.sdc.tosca.parser.enums.SdcTypes; import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Propagation; @@ -46,7 +46,7 @@ import org.springframework.transaction.annotation.Transactional; @Component public class CdsDataInstaller { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(CdsDataInstaller.class); + private static final Logger logger = LoggerFactory.getLogger(CdsDataInstaller.class); @Autowired CdsServices cdsServices; @@ -81,8 +81,9 @@ public class CdsDataInstaller { .add(CONTROLLER_PROPERTIES, controllerProperties); logger.info("Successfully installed the CDS data in Service"); } else { - logger.warn("Skipping CDS data installation in Service, as sdnc_model_name and " - + "sdnc_model_version are not provided in the CSAR"); + logger.warn( + "Skipping CDS data installation in Service, as sdnc_model_name" + + " and sdnc_model_version are not provided in the CSAR"); } } } @@ -147,8 +148,8 @@ public class CdsDataInstaller { JsonObject workFlowProps = new JsonObject(); for (String workFlow : response.getWorkflows()) { - logger.info("Found CDS workflow " + workFlow + " for model name " + sdncModelName + " and version " - + sdncModelVersion); + logger.info("Found CDS workflow {} for model name {} and version {}", + workFlow, sdncModelName, sdncModelVersion); JsonObject inputs = queryCdsToGetWorkFlowInputProperties(response.getBlueprintName(), response.getVersion(), workFlow); workFlowProps.add(workFlow, inputs); diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java b/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java index e6c05ddd9..424a81989 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/DcaeComponent.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.loop.components.external; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import java.util.Iterator; import java.util.LinkedList; @@ -41,6 +39,8 @@ import org.onap.policy.clamp.clds.model.dcae.DcaeOperationStatusResponse; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.loop.Loop; import org.onap.policy.clamp.policy.microservice.MicroServicePolicy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DcaeComponent extends ExternalComponent { private static final String INSTALL = "install"; @@ -49,7 +49,7 @@ public class DcaeComponent extends ExternalComponent { private static final String UNINSTALL = "uninstall"; @Transient - private static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeComponent.class); + private static final Logger logger = LoggerFactory.getLogger(DcaeComponent.class); private static final String DCAE_DEPLOYMENT_PREFIX = "CLAMP_"; private static final String DEPLOYMENT_PARAMETER = "dcaeDeployParameters"; @@ -150,7 +150,7 @@ public class DcaeComponent extends ExternalComponent { if (deploymentProp != null) { rootObject.add(DCAE_INPUTS, deploymentProp); } - logger.info("DCAE Deploy payload for unique blueprint: " + rootObject.toString()); + logger.info("DCAE Deploy payload for unique blueprint: {}", rootObject); return rootObject.toString(); } @@ -173,7 +173,7 @@ public class DcaeComponent extends ExternalComponent { if (deploymentProp != null) { rootObject.add(DCAE_INPUTS, deploymentProp); } - logger.info("DCAE Deploy payload for multiple blueprints: " + rootObject.toString()); + logger.info("DCAE Deploy payload for multiple blueprints: {}", rootObject); return rootObject.toString(); } @@ -186,7 +186,7 @@ public class DcaeComponent extends ExternalComponent { public static String getUndeployPayload(Loop loop) { var rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, loop.getLoopTemplate().getDcaeBlueprintId()); - logger.info("DCAE Undeploy payload for unique blueprint: " + rootObject.toString()); + logger.info("DCAE Undeploy payload for unique blueprint: {}", rootObject); return rootObject.toString(); } @@ -199,7 +199,7 @@ public class DcaeComponent extends ExternalComponent { public static String getUndeployPayload(MicroServicePolicy policy) { var rootObject = new JsonObject(); rootObject.addProperty(DCAE_SERVICETYPE_ID, policy.getDcaeBlueprintId()); - logger.info("DCAE Undeploy payload for multiple blueprints: " + rootObject.toString()); + logger.info("DCAE Undeploy payload for multiple blueprints: {}", rootObject); return rootObject.toString(); } diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/PolicyComponent.java b/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/PolicyComponent.java index 27e8e1a13..2cd8b241a 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/PolicyComponent.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/components/external/PolicyComponent.java @@ -23,12 +23,12 @@ package org.onap.policy.clamp.loop.components.external; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import javax.persistence.Transient; import org.apache.camel.Exchange; import org.onap.policy.clamp.loop.Loop; import org.onap.policy.clamp.policy.pdpgroup.PdpGroupPayload; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class represents the policy state according to all policies involved in the control loop. @@ -38,7 +38,7 @@ import org.onap.policy.clamp.policy.pdpgroup.PdpGroupPayload; public class PolicyComponent extends ExternalComponent { @Transient - private static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyComponent.class); + private static final Logger logger = LoggerFactory.getLogger(PolicyComponent.class); public static final ExternalComponentState IN_ERROR = new ExternalComponentState("IN_ERROR", "There was an error during the sending to policy, the policy engine may be corrupted or inconsistent", 100); diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java b/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java index 1429d73c2..acbf716b0 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/service/CsarServiceInstaller.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.loop.service; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import java.util.Map.Entry; import org.onap.policy.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; @@ -38,6 +36,8 @@ import org.onap.sdc.tosca.parser.enums.EntityTemplateType; import org.onap.sdc.tosca.parser.enums.SdcTypes; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @@ -47,7 +47,7 @@ import org.springframework.transaction.annotation.Transactional; @Component @Qualifier("csarInstaller") public class CsarServiceInstaller { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(CsarServiceInstaller.class); + private static final Logger logger = LoggerFactory.getLogger(CsarServiceInstaller.class); @Autowired ServicesRepository serviceRepository; diff --git a/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java b/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java index b7442abc5..ecc174b7f 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java +++ b/runtime/src/main/java/org/onap/policy/clamp/loop/service/Service.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.loop.service; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; import java.io.Serializable; @@ -38,6 +36,8 @@ import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.dao.model.jsontype.StringJsonUserType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Entity @Table(name = "services") @@ -50,7 +50,7 @@ public class Service implements Serializable { private static final long serialVersionUID = 1331119060272760758L; @Transient - private static final EELFLogger logger = EELFManager.getInstance().getLogger(Service.class); + private static final Logger logger = LoggerFactory.getLogger(Service.class); @Id @Column(name = "service_uuid", unique = true) diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java b/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java index 11587ce57..6c0da687c 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/Policy.java @@ -25,8 +25,6 @@ package org.onap.policy.clamp.policy; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; import java.io.UnsupportedEncodingException; @@ -44,13 +42,15 @@ import org.onap.policy.clamp.loop.common.AuditEntity; import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.loop.template.LoopElementModel; import org.onap.policy.clamp.loop.template.PolicyModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @MappedSuperclass @TypeDef(name = "json", typeClass = StringJsonUserType.class) public abstract class Policy extends AuditEntity { @Transient - private static final EELFLogger logger = EELFManager.getInstance().getLogger(Policy.class); + private static final Logger logger = LoggerFactory.getLogger(Policy.class); @Expose @Type(type = "json") diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java b/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java index d56480053..8c1d9b5fd 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyEngineServices.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.policy; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import java.util.LinkedHashMap; import org.apache.camel.CamelContext; @@ -36,6 +34,8 @@ import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.loop.template.PolicyModel; import org.onap.policy.clamp.loop.template.PolicyModelsService; import org.onap.policy.models.pdp.concepts.PdpGroups; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Component; @@ -58,7 +58,7 @@ public class PolicyEngineServices { private static final String RAISE_EXCEPTION_FLAG = "raiseHttpExceptionFlag"; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyEngineServices.class); + private static final Logger logger = LoggerFactory.getLogger(PolicyEngineServices.class); private int retryInterval = 0; private int retryLimit = 1; @@ -106,8 +106,8 @@ public class PolicyEngineServices { return null; } } else { - logger.info("Skipping policy model download as it exists already in the database " + policyType - + "/" + policyVersion); + logger.info("Skipping policy model download as it exists already in the database {} / {}", + policyType, policyVersion); return policyModelFound; } } @@ -161,7 +161,8 @@ public class PolicyEngineServices { * @return A string with the whole policy tosca model */ public String downloadOnePolicyToscaModel(String policyType, String policyVersion) { - logger.info("Downloading the policy tosca model " + policyType + "/" + policyVersion); + logger.info("Downloading the policy tosca model {} / {}", + policyType, policyVersion); var options = new DumperOptions(); options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); options.setIndent(4); @@ -207,13 +208,13 @@ public class PolicyEngineServices { .is2xxSuccessful()) { return (String) exchangeResponse.getIn().getBody(); } else { - logger.info(logMsg + " query " + retryInterval + "ms before retrying ..."); + logger.info("{} query ms before retrying {} ...", logMsg, retryInterval); // wait for a while and try to connect to DCAE again Thread.sleep(retryInterval); } } catch (IOException e) { - logger.error("IOException caught when trying to call Camel flow:" + camelFlow, e); + logger.error("IOException caught when trying to call Camel flow: {}", camelFlow, e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java b/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java index d2c860150..2eb78d240 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/PolicyPayload.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.policy; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.io.UnsupportedEncodingException; @@ -32,6 +30,8 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import org.onap.policy.clamp.clds.util.JsonUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.yaml.snakeyaml.Yaml; /** @@ -39,7 +39,7 @@ import org.yaml.snakeyaml.Yaml; */ public class PolicyPayload { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyPayload.class); + private static final Logger logger = LoggerFactory.getLogger(PolicyPayload.class); private static JsonObject createJsonFromPolicyTosca(String toscaContent) { Map<String, Object> map = @@ -85,7 +85,7 @@ public class PolicyPayload { policyDetails.add("properties", policyProperties); String policyPayload = JsonUtils.GSON.toJson(policyPayloadResult); - logger.info("Policy payload: " + policyPayload); + logger.info("Policy payload: {}", policyPayload); return policyPayload; } }
\ No newline at end of file diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/downloader/PolicyEngineController.java b/runtime/src/main/java/org/onap/policy/clamp/policy/downloader/PolicyEngineController.java index 81775e5da..774ba0992 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/downloader/PolicyEngineController.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/downloader/PolicyEngineController.java @@ -23,12 +23,12 @@ package org.onap.policy.clamp.policy.downloader; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.time.Instant; import org.json.simple.parser.ParseException; import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.onap.policy.clamp.policy.PolicyEngineServices; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; @@ -43,9 +43,7 @@ import org.springframework.scheduling.annotation.Scheduled; @Profile("clamp-policy-controller") public class PolicyEngineController { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(PolicyEngineController.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + protected static final Logger logger = LoggerFactory.getLogger(PolicyEngineController.class); public static final String POLICY_RETRY_INTERVAL = "policy.retry.interval"; public static final String POLICY_RETRY_LIMIT = "policy.retry.limit"; diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java index 1646a7cc7..deb425106 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicy.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.policy.operational; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; import java.io.Serializable; @@ -49,6 +47,8 @@ import org.onap.policy.clamp.loop.service.Service; import org.onap.policy.clamp.loop.template.LoopElementModel; import org.onap.policy.clamp.loop.template.PolicyModel; import org.onap.policy.clamp.policy.Policy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Entity @Table(name = "operational_policies") @@ -60,7 +60,7 @@ public class OperationalPolicy extends Policy implements Serializable { private static final long serialVersionUID = 6117076450841538255L; @Transient - private static final EELFLogger logger = EELFManager.getInstance().getLogger(OperationalPolicy.class); + private static final Logger logger = LoggerFactory.getLogger(OperationalPolicy.class); @Id @Expose diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java index 6718475ca..ee8db290d 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java @@ -24,8 +24,6 @@ package org.onap.policy.clamp.policy.operational; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -36,11 +34,13 @@ import java.util.Set; import org.onap.policy.clamp.clds.util.JsonUtils; import org.onap.policy.clamp.clds.util.ResourceFileUtils; import org.onap.policy.clamp.loop.service.Service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class OperationalPolicyRepresentationBuilder { - private static final EELFLogger logger = - EELFManager.getInstance().getLogger(OperationalPolicyRepresentationBuilder.class); + private static final Logger logger = + LoggerFactory.getLogger(OperationalPolicyRepresentationBuilder.class); public static final String PROPERTIES = "properties"; public static final String ITEMS = "items"; diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java index 3f3f39b45..baedc47b8 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/operational/OperationalPolicyService.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.policy.operational; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -32,6 +30,8 @@ import org.onap.policy.clamp.clds.tosca.update.ToscaConverterWithDictionarySuppo import org.onap.policy.clamp.loop.Loop; import org.onap.policy.clamp.loop.template.PolicyModelsRepository; import org.onap.policy.clamp.policy.PolicyService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -42,7 +42,7 @@ public class OperationalPolicyService implements PolicyService<OperationalPolicy private final PolicyModelsRepository policyModelsRepository; - private static final EELFLogger logger = EELFManager.getInstance().getLogger(OperationalPolicyService.class); + private static final Logger logger = LoggerFactory.getLogger(OperationalPolicyService.class); @Autowired public OperationalPolicyService(OperationalPolicyRepository repository, diff --git a/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java b/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java index c6b44076f..63adf4a32 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java +++ b/runtime/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupPayload.java @@ -23,8 +23,6 @@ package org.onap.policy.clamp.policy.pdpgroup; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import com.google.gson.JsonElement; import java.util.ArrayList; import java.util.Arrays; @@ -33,6 +31,8 @@ import org.onap.policy.models.pdp.concepts.DeploymentGroup; import org.onap.policy.models.pdp.concepts.DeploymentGroups; import org.onap.policy.models.pdp.concepts.DeploymentSubGroup; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is an utility class that build the PDP group policy payload. @@ -42,7 +42,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; */ public class PdpGroupPayload { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(PdpGroupPayload.class); + private static final Logger logger = LoggerFactory.getLogger(PdpGroupPayload.class); /** * The default node that will contain the actions array. @@ -90,7 +90,7 @@ public class PdpGroupPayload { if (opParams.length == 5) { this.updatePdpGroupMap(opParams[1], opParams[2], opParams[3], opParams[4], opParams[0]); } else { - logger.error("One PDP push command does not contain the right number of arguments: " + action); + logger.error("One PDP push command does not contain the right number of arguments: {}", action); throw new PdpGroupPayloadException( "One PDP push command does not contain the right number of arguments: " + action); } @@ -135,7 +135,7 @@ public class PdpGroupPayload { */ public String generatePdpGroupPayload() { String payload = JsonUtils.GSON.toJson(this.deploymentGroups); - logger.info("PdpGroup policy payload: " + payload); + logger.info("PdpGroup policy payload: {}", payload); return payload; } } diff --git a/runtime/src/main/java/org/onap/policy/clamp/util/PassDecoder.java b/runtime/src/main/java/org/onap/policy/clamp/util/PassDecoder.java index b8e90e3d0..9052c382e 100644 --- a/runtime/src/main/java/org/onap/policy/clamp/util/PassDecoder.java +++ b/runtime/src/main/java/org/onap/policy/clamp/util/PassDecoder.java @@ -22,11 +22,11 @@ package org.onap.policy.clamp.util; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; import java.io.IOException; import org.onap.aaf.cadi.Symm; import org.onap.policy.clamp.clds.util.ResourceFileUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * PassDecoder for decrypting the truststore and keystore password. @@ -39,7 +39,7 @@ public class PassDecoder { /** * Used to log PassDecoder class. */ - private static final EELFLogger logger = EELFManager.getInstance().getLogger(PassDecoder.class); + private static final Logger logger = LoggerFactory.getLogger(PassDecoder.class); /** * Decode the password. diff --git a/runtime/src/main/resources/application-noaaf.properties b/runtime/src/main/resources/application-noaaf.properties index e698cc0ce..12a08704f 100644 --- a/runtime/src/main/resources/application-noaaf.properties +++ b/runtime/src/main/resources/application-noaaf.properties @@ -134,7 +134,7 @@ async.core.pool.size=10 async.max.pool.size=20 async.queue.capacity=500 -#For EELF logback file +#For logback file #clamp.config.logback.path= clamp.config.logback.filename=logback-default.xml #The log folder that will be used in logback.xml file diff --git a/runtime/src/main/resources/application.properties b/runtime/src/main/resources/application.properties index 64097e88e..08260047e 100644 --- a/runtime/src/main/resources/application.properties +++ b/runtime/src/main/resources/application.properties @@ -134,7 +134,7 @@ async.core.pool.size=10 async.max.pool.size=20 async.queue.capacity=500 -#For EELF logback file +#For logback file #clamp.config.logback.path= clamp.config.logback.filename=logback-default.xml #The log folder that will be used in logback.xml file diff --git a/runtime/src/main/resources/logback-default.xml b/runtime/src/main/resources/logback-default.xml index 1d7b2a14f..f8ce5ae41 100644 --- a/runtime/src/main/resources/logback-default.xml +++ b/runtime/src/main/resources/logback-default.xml @@ -53,6 +53,10 @@ <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> </appender> + <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="ERROR" /> + </appender> <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${logDirectory}/debug.log</file> @@ -69,19 +73,14 @@ <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> </appender> - + <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender"> + <queueSize>256</queueSize> + <appender-ref ref="DEBUG" /> + </appender> <appender name="AUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>ENTRY</marker> - <marker>EXIT</marker> - </evaluator> - <onMismatch>DENY</onMismatch> - <onMatch>ACCEPT</onMatch> - </filter> + <filter class="org.onap.policy.clamp.clds.util.LoggerMarkerFilter$AuditLoggerMarkerFilter" /> <file>${logDirectory}/audit.log</file> - <append>true</append> <encoder> <pattern>${auditPattern}</pattern> </encoder> @@ -93,22 +92,14 @@ <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> </appender> - <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender"> + <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>256</queueSize> <appender-ref ref="AUDIT" /> </appender> <appender name="METRIC" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> - <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> - <marker>INVOKE</marker> - <marker>INVOKE-RETURN</marker> - </evaluator> - <onMismatch>DENY</onMismatch> - <onMatch>ACCEPT</onMatch> - </filter> + <filter class="org.onap.policy.clamp.clds.util.LoggerMarkerFilter$MetricLoggerMarkerFilter" /> <file>${logDirectory}/metric.log</file> - <append>true</append> <encoder> <pattern>${metricPattern}</pattern> </encoder> @@ -120,16 +111,15 @@ <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> </appender> - - <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender"> + <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>256</queueSize> <appender-ref ref="METRIC" /> </appender> <!-- SECURITY related loggers --> <appender name="SECURITY" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <filter class="org.onap.policy.clamp.clds.util.LoggerMarkerFilter$SecurityLoggerMarkerFilter" /> <file>${logDirectory}/security.log</file> - <append>true</append> <encoder> <pattern>%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%.20thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n </pattern> @@ -142,11 +132,11 @@ <totalSizeCap>1GB</totalSizeCap> </rollingPolicy> </appender> - - <appender name="asyncEELFSecurity" class="ch.qos.logback.classic.AsyncAppender"> + <appender name="asyncSecurity" class="ch.qos.logback.classic.AsyncAppender"> <queueSize>256</queueSize> <appender-ref ref="SECURITY" /> </appender> + <!-- logback jms appenders & loggers definition starts here --> <appender name="auditLogs" class="ch.qos.logback.core.rolling.RollingFileAppender"> <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> @@ -204,20 +194,6 @@ <appender-ref ref="DEBUG" /> </logger> - <logger name="com.att.eelf.error" level="OFF"> - <appender-ref ref="ERROR" /> - </logger> - <!-- EELF related loggers --> - <logger name="com.att.eelf.audit" level="INFO" additivity="false"> - <appender-ref ref="asyncEELFAudit" /> - </logger> - <logger name="com.att.eelf.metrics" level="DEBUG" additivity="false"> - <appender-ref ref="asyncEELFMetrics" /> - </logger> - <logger name="com.att.eelf.security" level="DEBUG" additivity="false"> - <appender-ref ref="asyncEELFSecurity" /> - </logger> - <!-- logback internals logging --> <logger name="ch.qos.logback.classic" level="INFO" /> <logger name="ch.qos.logback.core" level="INFO" /> @@ -233,10 +209,10 @@ <!-- logback jms appenders & loggers definition ends here --> <root level="DEBUG"> - <appender-ref ref="DEBUG" /> - <appender-ref ref="STDOUT" /> - <appender-ref ref="AUDIT" /> - <appender-ref ref="METRIC" /> - <appender-ref ref="ERROR" /> + <appender-ref ref="asyncDebug" /> + <appender-ref ref="asyncError" /> + <appender-ref ref="asyncAudit" /> + <appender-ref ref="asyncMetric" /> + <appender-ref ref="asyncSecurity" /> </root> </included> |