airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [1/4] Added airavata logger implementation and Fixed AIRAVATA-1462
Date Fri, 03 Oct 2014 01:40:15 GMT
Repository: airavata
Updated Branches:
  refs/heads/master a256f3516 -> 881d169c6


http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/commons/utils/src/main/java/org/apache/airavata/common/logger/AiravataLoggerImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/utils/src/main/java/org/apache/airavata/common/logger/AiravataLoggerImpl.java
b/modules/commons/utils/src/main/java/org/apache/airavata/common/logger/AiravataLoggerImpl.java
new file mode 100644
index 0000000..74ab401
--- /dev/null
+++ b/modules/commons/utils/src/main/java/org/apache/airavata/common/logger/AiravataLoggerImpl.java
@@ -0,0 +1,323 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+ */
+
+package org.apache.airavata.common.logger;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AiravataLoggerImpl implements AiravataLogger{
+
+    private Logger logger;
+
+    public AiravataLoggerImpl(Class aClass) {
+        logger = LoggerFactory.getLogger(aClass);
+    }
+
+    public AiravataLoggerImpl(String className) {
+        logger = LoggerFactory.getLogger(className);
+    }
+
+
+    @Override
+    public String getName() {
+        return logger.getName();
+    }
+
+    @Override
+    public boolean isTraceEnabled() {
+        return logger.isTraceEnabled();
+    }
+
+    @Override
+    public void trace(String msg) {
+        logger.trace(msg);
+    }
+
+    @Override
+    public void traceId(String etjId, String msg) {
+        logger.trace(getAiravataLogMessage(etjId, msg));
+    }
+
+    @Override
+    public void trace(String format, Object arg) {
+        logger.trace(format, arg);
+    }
+
+    @Override
+    public void traceId(String etjId, String format, Object arg) {
+        logger.trace(getAiravataLogMessage(etjId, format), arg);
+    }
+
+    @Override
+    public void trace(String format, Object arg1, Object arg2) {
+        logger.trace(format, arg1, arg2);
+    }
+
+    @Override
+    public void traceId(String etjId, String format, Object arg1, Object arg2) {
+        logger.trace(getAiravataLogMessage(etjId,format), arg1, arg2);
+    }
+
+    @Override
+    public void trace(String format, Object... arguments) {
+        logger.trace(format, arguments);
+    }
+
+    @Override
+    public void traceId(String etjId, String format, Object... arguments) {
+        logger.trace(getAiravataLogMessage(etjId, format), arguments);
+    }
+
+    @Override
+    public void trace(String msg, Throwable t) {
+        logger.trace(msg, t);
+    }
+
+    @Override
+    public void traceId(String etjId, String msg, Throwable t) {
+        logger.trace(getAiravataLogMessage(etjId, msg), t);
+    }
+
+    @Override
+    public boolean isDebugEnabled() {
+        return logger.isDebugEnabled();
+    }
+
+    @Override
+    public void debug(String msg) {
+        logger.debug(msg);
+    }
+
+    @Override
+    public void debugId(String etjId, String msg) {
+        logger.debug(getAiravataLogMessage(etjId, msg));
+    }
+
+    @Override
+    public void debug(String format, Object arg) {
+        logger.debug(format, arg);
+    }
+
+    @Override
+    public void debugId(String etjId, String format, Object arg) {
+        logger.debug(getAiravataLogMessage(etjId, format), arg);
+    }
+
+    @Override
+    public void debug(String format, Object arg1, Object arg2) {
+        logger.debug(format, arg1, arg2);
+    }
+
+    @Override
+    public void debugId(String etjId, String format, Object arg1, Object arg2) {
+        logger.debug(getAiravataLogMessage(etjId, format), arg1, arg2);
+    }
+
+    @Override
+    public void debug(String format, Object... arguments) {
+        logger.debug(format, arguments);
+    }
+
+    @Override
+    public void debugId(String etjId, String format, Object... arguments) {
+        logger.debug(getAiravataLogMessage(etjId, format), arguments);
+    }
+
+    @Override
+    public void debug(String msg, Throwable t) {
+        logger.debug(msg, t);
+    }
+
+    @Override
+    public void debugId(String etjId, String msg, Throwable t) {
+        logger.debug(getAiravataLogMessage(etjId, msg), t);
+    }
+
+    @Override
+    public boolean isInfoEnabled() {
+        return logger.isInfoEnabled();
+    }
+
+    @Override
+    public void info(String msg) {
+        logger.info(msg);
+    }
+
+    @Override
+    public void infoId(String etjId, String msg) {
+        logger.info(getAiravataLogMessage(etjId, msg));
+    }
+
+    @Override
+    public void info(String format, Object arg) {
+        logger.info(format, arg);
+    }
+
+    @Override
+    public void infoId(String etjId, String format, Object arg) {
+        logger.info(getAiravataLogMessage(etjId, format), arg);
+    }
+
+    @Override
+    public void info(String format, Object arg1, Object arg2) {
+        logger.info(format, arg1, arg2);
+    }
+
+    @Override
+    public void infoId(String etjId, String format, Object arg1, Object arg2) {
+        logger.info(getAiravataLogMessage(etjId, format), arg1, arg2);
+    }
+
+    @Override
+    public void info(String format, Object... arguments) {
+        logger.info(format, arguments);
+    }
+
+    @Override
+    public void infoId(String etjId, String format, Object... arguments) {
+        logger.info(getAiravataLogMessage(etjId, format), arguments);
+    }
+
+    @Override
+    public void info(String msg, Throwable t) {
+        logger.info(msg, t);
+    }
+
+    @Override
+    public void infoId(String etjId, String msg, Throwable t) {
+        logger.info(getAiravataLogMessage(etjId, msg), t);
+    }
+
+    @Override
+    public boolean isWarnEnabled() {
+        return logger.isWarnEnabled();
+    }
+
+    @Override
+    public void warn(String msg) {
+        logger.warn(msg);
+    }
+
+    @Override
+    public void warnId(String etjId, String msg) {
+        logger.warn(getAiravataLogMessage(etjId, msg));
+    }
+
+    @Override
+    public void warn(String format, Object arg) {
+        logger.warn(format, arg);
+    }
+
+    @Override
+    public void warnId(String etjId, String format, Object arg) {
+        logger.warn(getAiravataLogMessage(etjId, format), arg);
+    }
+
+    @Override
+    public void warn(String format, Object... arguments) {
+        logger.warn(format, arguments);
+    }
+
+    @Override
+    public void warnId(String etjId, String format, Object... arguments) {
+        logger.warn(getAiravataLogMessage(etjId, format), arguments);
+    }
+
+    @Override
+    public void warn(String format, Object arg1, Object arg2) {
+        logger.warn(format, arg1, arg2);
+    }
+
+    @Override
+    public void warnId(String etjId, String format, Object arg1, Object arg2) {
+        logger.warn(getAiravataLogMessage(etjId, format), arg1, arg2);
+    }
+
+    @Override
+    public void warn(String msg, Throwable t) {
+        logger.warn(msg, t);
+    }
+
+    @Override
+    public void warnId(String etjId, String msg, Throwable t) {
+        logger.warn(getAiravataLogMessage(etjId, msg), t);
+    }
+
+    @Override
+    public boolean isErrorEnabled() {
+        return logger.isErrorEnabled();
+    }
+
+    @Override
+    public void error(String msg) {
+        logger.error(msg);
+    }
+
+    @Override
+    public void errorId(String etjId, String msg) {
+        logger.error(getAiravataLogMessage(etjId, msg));
+    }
+
+    @Override
+    public void error(String format, Object arg) {
+        logger.error(format, arg);
+    }
+
+    @Override
+    public void errorId(String etjId, String format, Object arg) {
+        logger.error(getAiravataLogMessage(etjId, format), arg);
+    }
+
+    @Override
+    public void error(String format, Object arg1, Object arg2) {
+        logger.error(format, arg1, arg2);
+    }
+
+    @Override
+    public void errorId(String etjId, String format, Object arg1, Object arg2) {
+        logger.error(getAiravataLogMessage(etjId, format), arg1, arg2);
+    }
+
+    @Override
+    public void error(String format, Object... arguments) {
+        logger.error(format, arguments);
+    }
+
+    @Override
+    public void errorId(String etjId, String format, Object... arguments) {
+        logger.error(getAiravataLogMessage(etjId, format), arguments);
+    }
+
+    @Override
+    public void error(String msg, Throwable t) {
+        logger.error(msg, t);
+    }
+
+    @Override
+    public void errorId(String etjId, String msg, Throwable t) {
+        logger.error(getAiravataLogMessage(etjId, msg), t);
+    }
+
+    private String getAiravataLogMessage(String etjId, String msg) {
+        return new StringBuilder("Id:").append(etjId).append(" : ").append(msg).toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index 3d86dff..2cadfc7 100644
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -22,11 +22,12 @@ package org.apache.airavata.gfac.server;
 
 import com.google.common.eventbus.EventBus;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.AiravataZKUtils;
 import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.common.utils.MonitorPublisher;
 import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
 import org.apache.airavata.gfac.core.cpi.GFac;
 import org.apache.airavata.gfac.core.utils.GFacThreadPoolExecutor;
@@ -38,8 +39,6 @@ import org.apache.airavata.registry.cpi.Registry;
 import org.apache.thrift.TException;
 import org.apache.zookeeper.*;
 import org.apache.zookeeper.data.Stat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
@@ -49,7 +48,7 @@ import java.util.concurrent.Future;
 
 
 public class GfacServerHandler implements GfacService.Iface, Watcher{
-    private final static Logger logger = LoggerFactory.getLogger(GfacServerHandler.class);
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(GfacServerHandler.class);
 
     private Registry registry;
 
@@ -194,20 +193,29 @@ public class GfacServerHandler implements GfacService.Iface, Watcher{
      * @param gatewayId
      */
     public boolean submitJob(String experimentId, String taskId, String gatewayId) throws
TException {
-        logger.info("GFac Recieved the Experiment: " + experimentId + " TaskId: " + taskId);
+        logger.infoId(experimentId, "GFac Received the Experiment: {} TaskId: {}", experimentId,
taskId);
         GFac gfac = getGfac();
         InputHandlerWorker inputHandlerWorker = new InputHandlerWorker(gfac, experimentId,
taskId, gatewayId);
         inHandlerFutures.add(GFacThreadPoolExecutor.getCachedThreadPool().submit(inputHandlerWorker));
+        logger.infoId(experimentId, "Invoked in handle worker for the experiment {} , task
{} and gateway {}",
+                experimentId, taskId, gatewayId);
         return true;
     }
 
     public boolean cancelJob(String experimentId, String taskId) throws TException {
-        logger.info("GFac Recieved the Experiment: " + experimentId + " TaskId: " + taskId);
+        logger.infoId(experimentId, "GFac Received cancel job request for Experiment: {}
TaskId: {} ", experimentId, taskId);
         GFac gfac = getGfac();
         try {
-            return gfac.cancel(experimentId, taskId, ServerSettings.getSetting(Constants.GATEWAY_NAME));
+            if (gfac.cancel(experimentId, taskId, ServerSettings.getSetting(Constants.GATEWAY_NAME)))
{
+                logger.debugId(experimentId, "Successfully cancelled job, experiment {} ,
task {}", experimentId, taskId);
+                return true;
+            } else {
+                logger.errorId(experimentId, "Job cancellation failed, experiment {} , task
{}", experimentId, taskId);
+                return false;
+            }
         } catch (Exception e) {
-            throw new TException("Error launching the experiment : " + e.getMessage(), e);
+            logger.errorId(experimentId, "Error cancelling the experiment {}.", experimentId);
+            throw new TException("Error cancelling the experiment : " + e.getMessage(), e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
index fa77324..fa4ecd2 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/MonitorID.java
@@ -20,14 +20,11 @@
 */
 package org.apache.airavata.gfac.core.monitor;
 
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.Constants;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.SecurityContext;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.sql.Timestamp;
 import java.util.Date;
@@ -38,7 +35,7 @@ This is the object which contains the data to identify a particular
 Job to start the monitoring
 */
 public class MonitorID {
-    private final static Logger logger = LoggerFactory.getLogger(MonitorID.class);
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(MonitorID.class);
 
     private String userName;
 
@@ -193,12 +190,12 @@ public class MonitorID {
         // because in some machines job state vanishes quicckly when the job is done
         // during that case job state comes as unknown.so we handle it here.
         if (this.state != null && status.equals(JobState.UNKNOWN)) {
-            int loginfo = getFailedCount() + 1;
-            logger.info("JobId:" + this.getJobID() + " Increasing the failed count to:" +
loginfo + "");
-            setFailedCount(getFailedCount() + 1);
+            this.failedCount++;
+            logger.infoId(this.getJobID(), "{} status came for job {}, Increasing the failed
count to: {}.",
+                    status.toString(), this.jobID, this.failedCount);
         }else {
             // normal scenario
-            logger.info("Resetting failed count to 0 because correct state came in");
+            logger.infoId(this.getJobID(), "Valid status {} came for job {}, resetting fail
count to 0", status.toString(), this.jobID);
             setFailedCount(0);
             this.state = status;
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
index 413e3a8..ceb440c 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/handlers/GridPullMonitorHandler.java
@@ -21,6 +21,8 @@
 package org.apache.airavata.gfac.monitor.handlers;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
@@ -39,8 +41,6 @@ import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.data.Stat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.util.Properties;
@@ -52,7 +52,7 @@ import java.util.Properties;
  * which is a slight variation of qstat monitoring.
  */
 public class GridPullMonitorHandler extends ThreadedHandler implements Watcher{
-    private final static Logger logger = LoggerFactory.getLogger(GridPullMonitorHandler.class);
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(GridPullMonitorHandler.class);
 
     private HPCPullMonitor hpcPullMonitor;
 
@@ -102,7 +102,8 @@ public class GridPullMonitorHandler extends ThreadedHandler implements
Watcher{
             CommonUtils.addMonitortoQueue(hpcPullMonitor.getQueue(), monitorID);
             CommonUtils.increaseZkJobCount(monitorID); // update change job count to zookeeper
         } catch (AiravataMonitorException e) {
-            logger.error("Error adding monitorID object to the queue with experiment ", monitorID.getExperimentID());
+            logger.errorId(monitorID.getJobID(), "Error adding job {} monitorID object to
the queue with experiment {}",
+                    monitorID.getJobID(),  monitorID.getExperimentID());
         }
     }
     public AuthenticationInfo getAuthenticationInfo() {

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index 5a14ac2..4cc36c5 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -21,18 +21,14 @@
 package org.apache.airavata.gfac.monitor.impl.pull.qstat;
 
 import com.google.common.eventbus.EventBus;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.MonitorPublisher;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gfac.GFacException;
-import org.apache.airavata.gfac.core.cpi.BetterGfacImpl;
 import org.apache.airavata.gfac.core.cpi.GFac;
 import org.apache.airavata.gfac.core.monitor.MonitorID;
-import org.apache.airavata.gfac.core.monitor.TaskIdentity;
 import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest;
-import org.apache.airavata.gfac.core.utils.GFacThreadPoolExecutor;
-import org.apache.airavata.gfac.core.utils.OutHandlerWorker;
 import org.apache.airavata.gfac.monitor.HostMonitorData;
 import org.apache.airavata.gfac.monitor.UserMonitorData;
 import org.apache.airavata.gfac.monitor.core.PullMonitor;
@@ -43,12 +39,9 @@ import org.apache.airavata.gsi.ssh.api.SSHApiException;
 import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
 import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
 import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.model.workspace.experiment.TaskState;
 import org.apache.airavata.schemas.gfac.GsisshHostType;
 import org.apache.airavata.schemas.gfac.SSHHostType;
 import org.apache.zookeeper.ZooKeeper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.sql.Timestamp;
 import java.util.*;
@@ -61,7 +54,7 @@ import java.util.concurrent.LinkedBlockingQueue;
  * in grid resources and retrieve the job status.
  */
 public class HPCPullMonitor extends PullMonitor {
-    private final static Logger logger = LoggerFactory.getLogger(HPCPullMonitor.class);
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(HPCPullMonitor.class);
     public static final int FAILED_COUNT = 3;
 
     // I think this should use DelayedBlocking Queue to do the monitoring*/
@@ -190,11 +183,12 @@ public class HPCPullMonitor extends PullMonitor {
                         while(iterator1.hasNext()) {
                             String cancelMId = iterator1.next();
                             if (cancelMId.equals(iMonitorID.getExperimentID() + "+" + iMonitorID.getTaskID()))
{
-                                logger.info("Found a match in monitoring Queue, so marking
this job to remove from monitor queue " + cancelMId);
-                                logger.info("ExperimentID: " + cancelMId.split("\\+")[0]
+ ",TaskID: " + cancelMId.split("\\+")[1] + "JobID" + iMonitorID.getJobID());
                                 iMonitorID.setStatus(JobState.CANCELED);
                                 completedJobs.put(iMonitorID.getJobName(), iMonitorID);
                                 iterator1.remove();
+                                logger.debugId(cancelMId, "Found a match in cancel monitor
queue, hence moved to the " +
+                                                "completed job queue, experiment {}, task
{} , job {}",
+                                        iMonitorID.getExperimentID(), iMonitorID.getTaskID(),
iMonitorID.getJobID());
                                 break;
                             }
                         }
@@ -210,6 +204,9 @@ public class HPCPullMonitor extends PullMonitor {
                                     logger.info("This job is finished because push notification
came with <username,jobName> " + completeId);
                                     completedJobs.put(iMonitorID.getJobName(), iMonitorID);
                                     iMonitorID.setStatus(JobState.COMPLETE);
+                                    logger.debugId(completeId, "Push notification updated
job {} status to {}. " +
+                                                    "experiment {} , task {}.", iMonitorID.getJobID(),
JobState.COMPLETE.toString(),
+                                            iMonitorID.getExperimentID(), iMonitorID.getTaskID());
                                     break;
                                 }
                                 //we have to make this empty everytime we iterate, otherwise
this list will accumulate and will
@@ -231,25 +228,31 @@ public class HPCPullMonitor extends PullMonitor {
                             iMonitorID.setStatus(jobStatuses.get(iMonitorID.getJobID() +
"," + iMonitorID.getJobName()));    //IMPORTANT this is NOT a simple setter we have a logic
                         }else if(JobState.COMPLETE.equals(iMonitorID.getStatus())){
                             completedJobs.put(iMonitorID.getJobName(), iMonitorID);
+                            logger.debugId(iMonitorID.getJobID(), "Moved job {} to completed
jobs map, experiment {}, " +
+                                    "task {}", iMonitorID.getJobID(), iMonitorID.getExperimentID(),
iMonitorID.getTaskID());
                         }
                         jobStatus = new JobStatusChangeRequest(iMonitorID);
                         // we have this JobStatus class to handle amqp monitoring
 
                         publisher.publish(jobStatus);
+                        logger.debugId(jobStatus.getIdentity().getJobId(), "Published job
status change request, " +
+                                        "experiment {} , task {}", jobStatus.getIdentity().getExperimentID(),
+                                jobStatus.getIdentity().getTaskId());
                         // if the job is completed we do not have to put the job to the queue
again
                         iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
 
                         if (iMonitorID.getFailedCount() > FAILED_COUNT) {
-                            logger.error("Tried to monitor the job with ID " + iMonitorID.getJobID()
+ " But failed" + iMonitorID.getFailedCount() +
-                                    " 3 times, so skip this Job from Monitor");
                             iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
                             JobDescriptor jobDescriptor = JobDescriptor.fromXML(iMonitorID.getJobExecutionContext().getJobDetails().getJobDescription());
                             List<String> stdErr = connection.getCluster().listDirectory(jobDescriptor.getStandardErrorFile());
                             List<String> stdOut = connection.getCluster().listDirectory(jobDescriptor.getStandardOutFile());
                             if (stdErr.size() > 0 && stdOut.size() > 0) {
+                                logger.errorId(iMonitorID.getJobID(), "Job monitoring failed
{} times, removed job {} from " +
+                                                "monitor queue. Experiment {} , task {}",
iMonitorID.getFailedCount(),
+                                        iMonitorID.getExperimentID(), iMonitorID.getTaskID());
                                 completedJobs.put(iMonitorID.getJobName(), iMonitorID);
                             }
-                            } else {
+                        } else {
                             // Evey
                             iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
                             // if the job is complete we remove it from the Map, if any of
these maps
@@ -257,7 +260,8 @@ public class HPCPullMonitor extends PullMonitor {
                         }
                     }
                 } else {
-                    logger.debug("Qstat Monitor doesn't handle non-gsissh hosts");
+                    logger.debug("Qstat Monitor doesn't handle non-gsissh hosts , host {}",
iHostMonitorData.getHost()
+                            .getType().getHostAddress());
                 }
             }
             // We have finished all the HostMonitorData object in userMonitorData, now we
need to put it back

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
index c40d50d..f4b2109 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@ -21,6 +21,8 @@
 package org.apache.airavata.gfac.monitor.util;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.AiravataZKUtils;
 import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.commons.gfac.type.HostDescription;
@@ -39,8 +41,6 @@ import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooDefs;
 import org.apache.zookeeper.ZooKeeper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.HashMap;
@@ -51,7 +51,7 @@ import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
 
 public class CommonUtils {
-    private final static Logger logger = LoggerFactory.getLogger(CommonUtils.class);
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(CommonUtils.class);
 
     public static boolean isPBSHost(HostDescription host){
         if("pbs".equals(((GsisshHostType)host.getType()).getJobManager()) ||
@@ -106,6 +106,8 @@ public class CommonUtils {
                         if (host.getHost().toXML().equals(monitorID.getHost().toXML())) {
                             // ok we found right place to add this monitorID
                             host.addMonitorIDForHost(monitorID);
+                            logger.debugId(monitorID.getJobID(), "Added new job to the monitoring
queue, experiment {}," +
+                                    " task {}", monitorID.getExperimentID(), monitorID.getTaskID());
                             return;
                         }
                     }
@@ -114,6 +116,8 @@ public class CommonUtils {
                     HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
                     hostMonitorData.addMonitorIDForHost(monitorID);
                     next.addHostMonitorData(hostMonitorData);
+                    logger.debugId(monitorID.getJobID(), "Added new job to the monitoring
queue, experiment {}," +
+                            " task {}", monitorID.getExperimentID(), monitorID.getTaskID());
                     return;
                 }
             }
@@ -124,6 +128,8 @@ public class CommonUtils {
             userMonitorData.addHostMonitorData(hostMonitorData);
             try {
                 queue.put(userMonitorData);
+                logger.debugId(monitorID.getJobID(), "Added new job to the monitoring queue,
experiment {}," +
+                        " task {}", monitorID.getExperimentID(), monitorID.getTaskID());
             } catch (InterruptedException e) {
                 throw new AiravataMonitorException(e);
             }
@@ -155,13 +161,17 @@ public class CommonUtils {
                                         || iMonitorID.getJobName().equals(monitorID.getJobName()))
{
                                     // OK we found the object, we cannot do list.remove(object)
states of two objects
                                     // could be different, thats why we check the jobID
-                                    logger.info("Removing the job:" + monitorID.getJobID()
+ " from monitoring last status:" + monitorID.getStatus().toString());
                                     monitorIDs.remove(iMonitorID);
+                                    logger.infoId(monitorID.getJobID(), "Removed the job:
{} from monitoring last " +
+                                            "status:{}", monitorID.getJobID(), monitorID.getStatus().toString());
                                     if (monitorIDs.size() == 0) {
                                         hostMonitorData.remove(iHostMonitorID);
+                                        logger.debug("Removed host {} from monitoring queue",
iHostMonitorID.getHost()
+                                                .getType().getHostAddress());
                                         if (hostMonitorData.size() == 0) {
                                             // no useful data so we have to remove the element
from the queue
                                             queue.remove(next);
+                                            logger.debug("Removed user {} from monitoring.",
next.getUserName());
                                         }
                                     }
                                     return;

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 6d9f259..a892984 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -27,6 +27,8 @@ import org.airavata.appcatalog.cpi.ComputeResource;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
 import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.AiravataZKUtils;
 import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.common.utils.ServerSettings;
@@ -51,8 +53,6 @@ import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowN
 import org.apache.thrift.TException;
 import org.apache.zookeeper.*;
 import org.apache.zookeeper.data.Stat;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
@@ -60,7 +60,7 @@ import java.util.*;
 
 public class OrchestratorServerHandler implements OrchestratorService.Iface,
 		Watcher {
-	private static Logger log = LoggerFactory
+	private static AiravataLogger log = AiravataLoggerFactory
 			.getLogger(OrchestratorServerHandler.class);
 
 	private SimpleOrchestratorImpl orchestrator = null;
@@ -166,8 +166,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
             experiment = (Experiment) registry.get(
                     RegistryModelType.EXPERIMENT, experimentId);
             if (experiment == null) {
-                log.error("Error retrieving the Experiment by the given experimentID: "
-                        + experimentId);
+                log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID:
{} ", experimentId);
                 return false;
             }
             List<String> ids = registry.getIds(
@@ -213,12 +212,15 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
 			try {
 				registry.update(RegistryModelType.EXPERIMENT, experiment,
 						experimentId);
-			} catch (RegistryException e1) {
+            } catch (RegistryException e1) {
+                log.errorId(experimentId, "Couldn't update the status {} of the experiment
{}.",
+                        ExperimentState.FAILED.toString(), experimentId);
 				throw new TException(e);
 			}
-
-			throw new TException(e);
+            log.errorId(experimentId, "Error while launching experiment {}.", experimentId);
+            throw new TException(e);
 		}
+        log.infoId(experimentId, "Successfully launched experiment {}.", experimentId);
 		return true;
 	}
 
@@ -256,8 +258,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
 					Experiment experiment = (Experiment) registry.get(
 							RegistryModelType.EXPERIMENT, experimentId);
 					if (experiment == null) {
-						log.error("Error retrieving the Experiment by the given experimentID: "
-								+ experimentId);
+						log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID:
{}.",
+                                experimentId);
 						return false;
 					}
 					return orchestrator.validateExperiment(experiment,
@@ -266,8 +268,10 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
 			}
 
 		} catch (OrchestratorException e) {
+            log.errorId(experimentId, "Error while validating experiment", e);
 			throw new TException(e);
 		} catch (RegistryException e) {
+            log.errorId(experimentId, "Error while validating experiment", e);
 			throw new TException(e);
 		}
 		return false;
@@ -282,7 +286,7 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
 	 * @throws TException
 	 */
 	public boolean terminateExperiment(String experimentId) throws TException {
-        log.info("Experiment: " + experimentId + " is cancelling  !!!!!");
+        log.infoId(experimentId, "Experiment: {} is cancelling  !!!!!", experimentId);
         return validateStatesAndCancel(experimentId);
 	}
 
@@ -406,9 +410,8 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
 					RegistryModelType.TASK_DETAIL, taskId);
 			String applicationId = taskData.getApplicationId();
 			if (applicationId == null) {
-				throw new OrchestratorException(
-						"Error executing the job because there is no Application Name in this Experiment: 
"
-								+ applicationId);
+                log.errorId(taskId, "Application id shouldn't be null.");
+				throw new OrchestratorException("Error executing the job, application id shouldn't be
null.");
 			}
 			ApplicationDeploymentDescription applicationDeploymentDescription = getAppDeployment(taskData,
applicationId);
             taskData.setApplicationDeploymentId(applicationDeploymentDescription.getAppDeploymentId());
@@ -429,8 +432,10 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
 				}
 			}
 		} catch (Exception e) {
+            log.errorId(taskId, "Error while launching task ", e);
             throw new TException(e);
         }
+        log.infoId(taskId, "No experiment found associated in task {}", taskId);
         return false;
 	}
 
@@ -491,15 +496,15 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface,
             Experiment experiment = (Experiment) registry.get(
                     RegistryModelType.EXPERIMENT, experimentId);
             if (experiment == null) {
-                log.error("Error retrieving the Experiment by the given experimentID: "
-                        + experimentId);
-                throw new OrchestratorException("Error retrieving the Experiment by the given
experimentID:\n" +
-                        experimentId);
+                log.errorId(experimentId, "Error retrieving the Experiment by the given experimentID:
{}.", experimentId);
+                throw new OrchestratorException("Error retrieving the Experiment by the given
experimentID: " + experimentId);
             }
             ExperimentState experimentState = experiment.getExperimentStatus().getExperimentState();
-            if (experimentState.getValue()> 5 && experimentState.getValue()<10){
-                    throw new OrchestratorException("Unable to mark experiment as Cancelled,
because current state is: "
-                    + experiment.getExperimentStatus().getExperimentState().toString());
+            if (experimentState.getValue()> 5 && experimentState.getValue()<10)
{
+                log.errorId(experimentId, "Unable to mark experiment as Cancelled, current
state {} doesn't allow to cancel the experiment {}.",
+                        experiment.getExperimentStatus().getExperimentState().toString(),
experimentId);
+                throw new OrchestratorException("Unable to mark experiment as Cancelled,
because current state is: "
+                        + experiment.getExperimentStatus().getExperimentState().toString());
             }else if(experimentState.getValue()<3){
                 // when experiment status is < 3 no jobDetails object is created,
                 // so we don't have to worry, we simply have to change the status and stop
the execution

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index 1d0a4a2..7e6a145 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -21,6 +21,8 @@
 
 package org.apache.airavata.persistance.registry.jpa.impl;
 
+import org.apache.airavata.common.logger.AiravataLogger;
+import org.apache.airavata.common.logger.AiravataLoggerFactory;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.persistance.registry.jpa.Resource;
@@ -33,9 +35,6 @@ import org.apache.airavata.registry.cpi.RegistryException;
 import org.apache.airavata.registry.cpi.RegistryModelType;
 import org.apache.airavata.registry.cpi.utils.Constants;
 import org.apache.airavata.registry.cpi.utils.StatusType;
-import org.apache.airavata.schemas.gfac.IntegerArrayType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.sql.Timestamp;
 import java.util.*;
@@ -43,7 +42,7 @@ import java.util.*;
 public class ExperimentRegistry {
     private GatewayResource gatewayResource;
     private WorkerResource workerResource;
-    private final static Logger logger = LoggerFactory.getLogger(ExperimentRegistry.class);
+    private final static AiravataLogger logger = AiravataLoggerFactory.getLogger(ExperimentRegistry.class);
 
     public ExperimentRegistry(GatewayResource gateway, UserResource user) throws RegistryException
{
         gatewayResource = gateway;
@@ -431,8 +430,9 @@ public class ExperimentRegistry {
             }
             status.setStatusType(StatusType.EXPERIMENT.toString());
             status.save();
+            logger.debugId(expId, "Updated experiment {} status to {}.", expId, experimentStatus.toString());
         } catch (Exception e) {
-            logger.error("Error while updating experiment status...", e);
+            logger.errorId(expId, "Error while updating experiment status...", e);
             throw new RegistryException(e);
         }
         return expId;
@@ -474,9 +474,10 @@ public class ExperimentRegistry {
             statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
             statusResource.setState(status.getWorkflowNodeState().toString());
             statusResource.save();
+            logger.debugId(nodeId, "Updated workflow node {} status to {}.", nodeId, status.toString());
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
-            logger.error("Error whilw updating workflow node status...", e);
+            logger.errorId(nodeId, "Error while updating workflow node status to " + status.toString()
+ "...", e);
             throw new RegistryException(e);
         }
     }
@@ -523,8 +524,9 @@ public class ExperimentRegistry {
             statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
             statusResource.setState(status.getExecutionState().toString());
             statusResource.save();
+            logger.infoId(taskId, "Updated task {} status to {}.", taskId, status.toString());
         } catch (Exception e) {
-            logger.error("Error while updating task status...", e);
+            logger.errorId(taskId, "Error while updating task status to " + status.toString()
+ "...", e);
             throw new RegistryException(e);
         }
     }
@@ -575,9 +577,10 @@ public class ExperimentRegistry {
             statusResource.setStatusUpdateTime(AiravataUtils.getTime(status.getTimeOfStateChange()));
             statusResource.setState(status.getJobState().toString());
             statusResource.save();
+            logger.infoId(ids.toString(), "Updated job status to {}", status.toString());
             return String.valueOf(statusResource.getStatusId());
         } catch (Exception e) {
-            logger.error("Error while updating job status...", e);
+            logger.errorId(ids.toString(), "Error while updating job status to " + status.toString()
+ " ...", e);
             throw new RegistryException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/595be55f/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/CompositeIdentifier.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/CompositeIdentifier.java
b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/CompositeIdentifier.java
index 0234aa3..fee8aec 100644
--- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/CompositeIdentifier.java
+++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/CompositeIdentifier.java
@@ -41,4 +41,16 @@ public class CompositeIdentifier {
     public Object getSecondLevelIdentifier() {
         return secondLevelIdentifier;
     }
+
+    @Override
+    public String toString() {
+        if (topLevelIdentifier instanceof String && secondLevelIdentifier instanceof
String) {
+            return topLevelIdentifier + "," + secondLevelIdentifier;
+        }else if (topLevelIdentifier instanceof String ) {
+            return topLevelIdentifier.toString();
+        } else {
+            return secondLevelIdentifier.toString();
+        }
+
+    }
 }


Mime
View raw message