From 5fa5abbda33abee2d849da18af564e8cc542f9ec Mon Sep 17 00:00:00 2001 From: "o.abakumov" Date: Wed, 2 Aug 2017 08:54:09 +0300 Subject: [PATCH] [SECIOTSRK-359] Change the logs level for existing source code of ServerMQ (merged) --- servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java | 1 - .../com/samsung/servermq/iotivity/MessageQueueListener.java | 6 +++--- .../com/samsung/servermq/iotivity/MessageQueuePublisher.java | 4 ++-- .../iotivity/extractor/impl/PolicyPostDataExtractor.java | 2 +- .../iotivity/extractor/impl/ReportPostDataExtractor.java | 2 +- .../main/java/com/samsung/servermq/rest/DSMRestController.java | 2 +- .../java/com/samsung/servermq/utils/rest/ServerSenderImpl.java | 10 +++++----- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java b/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java index b434b67..c90ae58 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java +++ b/servers/mq/src/main/java/com/samsung/servermq/ServerMQ.java @@ -14,7 +14,6 @@ public class ServerMQ { private static final Logger log = Logger.getLogger(ServerMQ.class); public static void main(String[] args) { - log.info("-----DSM MQ SERVER-----"); SpringApplication.run(ServerMQ.class, args); } diff --git a/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueueListener.java b/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueueListener.java index d203a40..13fccf1 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueueListener.java +++ b/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueueListener.java @@ -23,7 +23,7 @@ public class MessageQueueListener { public MessageQueueListener(String topicName, PostDataExtractor extractor, String listenerName, String zookeperHost, String kafkaHost) { - log.info("Created " + listenerName); + log.debug("Created " + listenerName); this.extractor = extractor; this.listenerName = listenerName; @@ -35,14 +35,14 @@ public class MessageQueueListener { this.kafkaConsumer = new KafkaConsumerWrapper(zookeperHost, kafkaHost, topic); this.kafkaConsumer.subscribeTopic(); - log.info(listenerName + " waiting messages......................."); + log.debug(listenerName + " waiting messages......................."); } public List getMessages() { List messages = kafkaConsumer.getMessages(); for (byte[] message : messages) { - log.info(getListenerName() + " get message: " + (new String(message))); + log.debug(getListenerName() + " get message: " + (new String(message))); extractor.extract(message); } return messages; diff --git a/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueuePublisher.java b/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueuePublisher.java index c2117f0..2426af3 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueuePublisher.java +++ b/servers/mq/src/main/java/com/samsung/servermq/iotivity/MessageQueuePublisher.java @@ -16,7 +16,7 @@ public class MessageQueuePublisher implements Publisher{ private String kafkaBrokerHost; public MessageQueuePublisher(String kafkaHost) { - log.info("Create Message Queue Publisher"); + log.debug("Create Message Queue Publisher"); this.kafkaBrokerHost = kafkaHost; } @@ -32,7 +32,7 @@ public class MessageQueuePublisher implements Publisher{ result = true; mKafkaProducerOperator.closeConnection(); } - log.info("Message publish to " + topicName + " : " + new String(data)); + log.debug("Message publish to " + topicName + " : " + new String(data)); } catch (Exception e) { log.error(e.getMessage(), e); } diff --git a/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/PolicyPostDataExtractor.java b/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/PolicyPostDataExtractor.java index 5c044d4..b1fa888 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/PolicyPostDataExtractor.java +++ b/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/PolicyPostDataExtractor.java @@ -33,7 +33,7 @@ public class PolicyPostDataExtractor implements PostDataExtractor { try { String policyData = MessageQueueUtils.extractDataFromPayload(data, MessageQueueKeys.POLICY.getKey()); String did = MessageQueueUtils.extractDataFromPayload(data, MessageQueueKeys.DUID.getKey()); - log.info("Get policy data:" + policyData); + log.debug("Get policy data:" + policyData); Policy policy = policyService.setDevicePolicy(did, policyData); serverSender.requestPolicy(policy.getId(), did); } catch (Exception e) { diff --git a/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/ReportPostDataExtractor.java b/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/ReportPostDataExtractor.java index e17f74f..f8b3255 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/ReportPostDataExtractor.java +++ b/servers/mq/src/main/java/com/samsung/servermq/iotivity/extractor/impl/ReportPostDataExtractor.java @@ -33,7 +33,7 @@ public class ReportPostDataExtractor implements PostDataExtractor { try { String did = MessageQueueUtils.extractDataFromPayload(data, MessageQueueKeys.DUID.getKey()); String reportData = MessageQueueUtils.extractDataFromPayload(data, MessageQueueKeys.REPORT.getKey()); - log.info("Get report data:" + data); + log.debug("Get report data:" + data); Gson gson = new Gson(); PrepareReport report = gson.fromJson(reportData, PrepareReport.class); Device device = deviceService.findByUUID(did); diff --git a/servers/mq/src/main/java/com/samsung/servermq/rest/DSMRestController.java b/servers/mq/src/main/java/com/samsung/servermq/rest/DSMRestController.java index 7e47c7d..ece6a81 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/rest/DSMRestController.java +++ b/servers/mq/src/main/java/com/samsung/servermq/rest/DSMRestController.java @@ -65,7 +65,7 @@ public class DSMRestController { @RequestMapping(value = "/policy", method = RequestMethod.POST) public ResponseEntity sendPolicy(@RequestBody @Valid MQPolicy policy, BindingResult result) { - log.info("Get policy " + policy); + log.debug("Get policy " + policy); if(result.hasErrors()){ log.error("Policy is not valid"); return new ResponseEntity<>(BAD_REQUEST); diff --git a/servers/mq/src/main/java/com/samsung/servermq/utils/rest/ServerSenderImpl.java b/servers/mq/src/main/java/com/samsung/servermq/utils/rest/ServerSenderImpl.java index 5d40897..13651f8 100644 --- a/servers/mq/src/main/java/com/samsung/servermq/utils/rest/ServerSenderImpl.java +++ b/servers/mq/src/main/java/com/samsung/servermq/utils/rest/ServerSenderImpl.java @@ -31,13 +31,13 @@ public class ServerSenderImpl implements ServerSender { this.host = host; this.restTemplate = new RestTemplate(); - log.info("Server host: " + host); + log.debug("Server host: " + host); } @Override public boolean sendNotification(Long reportId) { try { - log.info(format("Send new report notification %s", reportId)); + log.debug(format("Send new report notification %s", reportId)); URI url = new URI(host + REST_FOR_NOTIFICATION + reportId); log.debug("Send to " + url); @SuppressWarnings("rawtypes") @@ -54,12 +54,12 @@ public class ServerSenderImpl implements ServerSender { @Override public boolean requestPolicy(Long policyId, String diveceId) { try { - log.info(format("Send request for policy %s", policyId)); + log.debug(format("Send request for policy %s", policyId)); URI url = new URI(host + REST_FOR_REQUEST_POLICY + policyId + "/device/" + diveceId); - log.info("Send to " + url); + log.debug("Send to " + url); @SuppressWarnings("rawtypes") ResponseEntity result = restTemplate.exchange(url, POST, null, ResponseEntity.class); - log.info("Response " + result); + log.debug("Response " + result); return result.getStatusCode() == OK; } catch (URISyntaxException e) { log.error(e.getMessage(), e); -- 2.7.4