summaryrefslogtreecommitdiffstats
path: root/so-monitoring/so-monitoring-handler/src
diff options
context:
space:
mode:
authorByung-Woo Jun <byung-woo.jun@ericsson.com>2018-09-17 11:11:52 -0400
committerByung-Woo Jun <byung-woo.jun@ericsson.com>2018-09-17 15:44:37 +0000
commit850c584ad984f7804908804cff61d744b6ebdf75 (patch)
treee007174a3924ce919a66d7dc44acd8b88455a0b2 /so-monitoring/so-monitoring-handler/src
parent7f14f0c2cb879573709b687697636095e134b231 (diff)
Fix to use common MsoLogger
Used the MsoLogger instead of using a separate logger Change-Id: I62f8f8ef64a6f56eadf65829c3bf9521d651fbbb Issue-ID: SO-1062 Signed-off-by: byungwoojun<byung-woo.jun@ericsson.com>
Diffstat (limited to 'so-monitoring/so-monitoring-handler/src')
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java27
-rw-r--r--so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java40
2 files changed, 39 insertions, 28 deletions
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java
index b1815b5350..2515c8f79b 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java
@@ -35,21 +35,21 @@ import org.onap.so.montoring.model.ProcessDefinitionDetail;
import org.onap.so.montoring.model.ProcessInstanceDetail;
import org.onap.so.montoring.model.ProcessInstanceIdDetail;
import org.onap.so.montoring.model.ProcessInstanceVariableDetail;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.google.common.base.Optional;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* @author waqas.ikram@ericsson.com
*/
@Service
public class CamundaProcessDataServiceProviderImpl implements CamundaProcessDataServiceProvider {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(CamundaProcessDataServiceProviderImpl.class);
-
+ private static final Logger LOGGER = LoggerFactory.getLogger(CamundaProcessDataServiceProviderImpl.class);
private final CamundaRestUrlProvider urlProvider;
private final HttpRestServiceProvider httpRestServiceProvider;
@@ -69,7 +69,9 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
if (processInstances.isPresent()) {
final ProcessInstance[] instances = processInstances.get();
- LOGGER.debug("found process instance for request id: {}, result size: {}", requestId, instances.length);
+ final String message = "found process instance for request id: " + requestId +
+ ", result size: " + instances.length;
+ LOGGER.debug(message);
if (instances.length > 0) {
for (int index = 0; index < instances.length; index++) {
@@ -77,12 +79,12 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
if (processInstance.getSuperProcessInstanceId() == null) {
return Optional.of(new ProcessInstanceIdDetail(processInstance.getId()));
}
- LOGGER.debug("found sub process instance id with super process instanceId: {}",
+ LOGGER.debug("found sub process instance id with super process instanceId: " +
processInstance.getSuperProcessInstanceId());
}
}
}
- LOGGER.error("Unable to find process intance for request id: {}", requestId);
+ LOGGER.error("Unable to find process intance for request id: " + requestId);
return Optional.absent();
}
@@ -101,7 +103,7 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
return Optional.of(instanceDetail);
}
- LOGGER.error("Unable to find process intance for id: {}", processInstanceId);
+ LOGGER.error("Unable to find process intance for id: " + processInstanceId);
return Optional.absent();
}
@@ -118,7 +120,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
return Optional.of(new ProcessDefinitionDetail(processDefinitionId, xmlDefinition));
}
}
- LOGGER.error("Unable to find process definition for processDefinitionId: {}", processDefinitionId);
+ LOGGER.error("Unable to find process definition for processDefinitionId: " +
+ processDefinitionId);
return Optional.absent();
}
@@ -145,7 +148,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
}
return activityInstanceDetails;
}
- LOGGER.error("Unable to find activity intance detail for process instance id: {}", processInstanceId);
+ LOGGER.error("Unable to find activity intance detail for process instance id: " +
+ processInstanceId);
return Collections.emptyList();
}
@@ -167,7 +171,8 @@ public class CamundaProcessDataServiceProviderImpl implements CamundaProcessData
}
return instanceVariableDetails;
}
- LOGGER.error("Unable to find process intance variable details for process instance id: {}", processInstanceId);
+ LOGGER.error("Unable to find process intance variable details for process instance id: "
+ + processInstanceId);
return Collections.emptyList();
}
diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java
index 35e6038a86..b5cafcf1ed 100644
--- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java
+++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java
@@ -21,8 +21,6 @@ package org.onap.so.montoring.rest.service;
import org.onap.so.montoring.exception.InvalidRestRequestException;
import org.onap.so.montoring.exception.RestProcessingException;
-import org.slf4j.ext.XLogger;
-import org.slf4j.ext.XLoggerFactory;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
@@ -33,13 +31,15 @@ import org.springframework.web.client.RestTemplate;
import com.google.common.base.Optional;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* @author waqas.ikram@ericsson.com
*/
public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
- private static final XLogger LOGGER = XLoggerFactory.getXLogger(HttpRestServiceProviderImpl.class);
-
+ private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestServiceProviderImpl.class);
private final RestTemplate restTemplate;
public HttpRestServiceProviderImpl(final RestTemplate restTemplate) {
@@ -48,12 +48,13 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
@Override
public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz) {
- LOGGER.trace("Will invoke HTTP GET using URL: {}", url);
+ LOGGER.trace("Will invoke HTTP GET using URL: " + url);
try {
final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.GET, null, clazz);
if (!response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: {}", url,
- response.getStatusCode());
+ final String message = "Unable to invoke HTTP GET using URL: " + url +
+ ", Response Code: " + response.getStatusCode();
+ LOGGER.error(message);
return Optional.absent();
}
@@ -61,8 +62,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
return Optional.of(response.getBody());
}
} catch (final HttpClientErrorException httpClientErrorException) {
- LOGGER.error("Unable to invoke HTTP GET using url: {}, Response: {}", url,
- httpClientErrorException.getRawStatusCode(), httpClientErrorException);
+ final String message = "Unable to invoke HTTP GET using url: " + url + ", Response: " +
+ httpClientErrorException.getRawStatusCode();
+ LOGGER.error(message, httpClientErrorException);
final int rawStatusCode = httpClientErrorException.getRawStatusCode();
if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) {
throw new InvalidRestRequestException("No result found for given url: " + url);
@@ -70,8 +72,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url);
} catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP GET using url: {}", url, restClientException);
- throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException);
+ LOGGER.error("Unable to invoke HTTP GET using url: " + url, restClientException);
+ throw new RestProcessingException("Unable to invoke HTTP GET using URL: " +
+ url, restClientException);
}
return Optional.absent();
@@ -83,8 +86,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
final HttpEntity<?> request = new HttpEntity<>(object);
final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.POST, request, clazz);
if (!response.getStatusCode().equals(HttpStatus.OK)) {
- LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: {}", url,
- response.getStatusCode());
+ final String message = "Unable to invoke HTTP GET using URL: " + url +
+ ", Response Code: " + response.getStatusCode();
+ LOGGER.error(message);
return Optional.absent();
}
@@ -93,8 +97,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
}
} catch (final HttpClientErrorException httpClientErrorException) {
- LOGGER.error("Unable to invoke HTTP POST using url: {}, Response: {}", url,
- httpClientErrorException.getRawStatusCode(), httpClientErrorException);
+ final String message = "Unable to invoke HTTP POST using url: " + url +
+ ", Response: " + httpClientErrorException.getRawStatusCode();
+ LOGGER.error(message, httpClientErrorException);
final int rawStatusCode = httpClientErrorException.getRawStatusCode();
if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) {
throw new InvalidRestRequestException("No result found for given url: " + url);
@@ -102,8 +107,9 @@ public class HttpRestServiceProviderImpl implements HttpRestServiceProvider {
throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url);
} catch (final RestClientException restClientException) {
- LOGGER.error("Unable to invoke HTTP POST using url: {}", url, restClientException);
- throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url, restClientException);
+ LOGGER.error("Unable to invoke HTTP POST using url: " + url, restClientException);
+ throw new RestProcessingException("Unable to invoke HTTP POST using URL: "
+ + url, restClientException);
}
return Optional.absent();