From 49b68189ff345b244a44d7e66af96079d82661a0 Mon Sep 17 00:00:00 2001 From: akshayAppd Date: Tue, 24 Oct 2017 21:46:25 +0530 Subject: [PATCH] Linux Monitoring Extensions Code Review Changes --- .../extensions/linux/LinuxMonitor.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/appdynamics/extensions/linux/LinuxMonitor.java b/src/main/java/com/appdynamics/extensions/linux/LinuxMonitor.java index 649bb7a..95b3546 100755 --- a/src/main/java/com/appdynamics/extensions/linux/LinuxMonitor.java +++ b/src/main/java/com/appdynamics/extensions/linux/LinuxMonitor.java @@ -95,20 +95,24 @@ public void run() { public TaskOutput execute(Map taskArgs, TaskExecutionContext taskExecutionContext) throws TaskExecutionException { - - if (taskArgs != null) { - if (!initialized) { - configure(taskArgs); - } - logger.info("Starting the Linux Monitoring task"); - if (logger.isDebugEnabled()) { - logger.debug("The arguments after appending the default values are " + taskArgs); + String msg = "Using Monitor Version [" + getImplementationVersion() + "]"; + logger.info(msg); + try{ + if (taskArgs != null) { + if (!initialized) { + configure(taskArgs); + } + logger.info("Starting the Linux Monitoring task"); + if (logger.isDebugEnabled()) { + logger.debug("The arguments after appending the default values are " + taskArgs); + } + configuration.executeTask(); + return new TaskOutput("Linux Monitor Metric Upload Complete"); } - configuration.executeTask(); - return new TaskOutput("Linux Monitor Metric Upload Complete"); + }catch(Exception e) { + logger.error("Failed to execute the Linux monitoring task", e); } throw new TaskExecutionException(logVersion() + "Linux monitoring task completed with failures."); - } private String logVersion() {