diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
index d76fbc2..57d3bf5 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
@@ -345,68 +345,65 @@
    * @return
    * @since ONAP Amsterdam Release
    */
-  public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId)
-      throws ApplicationException {
+	public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException {
 
-    ValidateUtil.assertObjectNotNull(jobId);
-    // Step 1: query the current resource operation status
-    ResourceOperationStatus nsOperInfo =
-        (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
-            nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+		ValidateUtil.assertObjectNotNull(jobId);
+		// Step 1: query the current resource operation status
+		ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+				nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
 
-    // Step 2: start query
-    LOGGER.info("query ns status -> begin");
-    String url = getUrl(jobId, CommonConstant.Step.QUERY);
-    String methodType = CommonConstant.MethodType.GET;
-    // prepare restful parameters and options
-    RestfulResponse rsp = RestfulUtil.send(url, methodType, "");
-    ValidateUtil.assertObjectNotNull(rsp);
-    LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
-    LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
-    // Step 3:check the response staus
-    if (!HttpCode.isSucess(rsp.getStatus())) {
-      LOGGER.info("fail to query job status");
-      nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
-      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-          DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
-    }
-    // Step 4: Process Network Service Instantiate Response
-    NsProgressStatus nsProgress =
-        JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class);
-    ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor();
-    // Step 5: update segment operation progress
+		// Step 2: start query
+		LOGGER.info("query ns status -> begin");
+		String url = getUrl(jobId, CommonConstant.Step.QUERY);
+		String methodType = CommonConstant.MethodType.GET;
+		// prepare restful parameters and options
+		RestfulResponse rsp = RestfulUtil.send(url, methodType, "");
+		ValidateUtil.assertObjectNotNull(rsp);
+		LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
+		LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
+		// Step 3:check the response staus
+		if (!HttpCode.isSucess(rsp.getStatus())) {
+			LOGGER.info("fail to query job status");
+			nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
+			nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+			nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+			(RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+			throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
+		}
+		// Step 4: Process Network Service Instantiate Response
+		NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class);
+		ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor();
+		// Step 5: update segment operation progress
 
-    nsOperInfo.setProgress(rspDesc.getProgress());
-    nsOperInfo.setStatusDescription(rspDesc.getStatusDescription());
-    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+		nsOperInfo.setProgress(rspDesc.getProgress());
+		nsOperInfo.setStatusDescription(rspDesc.getStatusDescription());
+		(RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
 
-    // Step 6: update segment operation status
-    if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress())
-        && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) {
-      LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType());
-      nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-            if(RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(nsOperInfo.getOperType())) {
-        nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
-      }
-      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-    } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) {
-      LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType());
-      nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
-      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-          DriverExceptionID.JOB_STATUS_ERROR);
-    } else {
-      LOGGER.error("unexcepted response status");
-    }
-    LOGGER.info("query ns status -> end");
+		// Step 6: update segment operation status
+		if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress())
+				&& RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) {
+			LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType());
+			nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
+			String operType = nsOperInfo.getOperType();
+			if (RequestsDbConstant.OperationType.CREATE.equalsIgnoreCase(operType)
+					|| "createInstance".equalsIgnoreCase(operType)) {
+				nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
+			}
+			(RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+		} else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) {
+			LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType());
+			nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
+			nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+			nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+			(RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+			throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
+		} else {
+			LOGGER.error("unexcepted response status");
+		}
+		LOGGER.info("query ns status -> end");
 
-    return rsp;
-  }
+		return rsp;
+	}
 
     /**
      * Scale NS instance
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
index 0bedd12..5168de8 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
@@ -38,11 +38,11 @@
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.util.EntityUtils;
 import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
-import org.openecomp.mso.logger.MessageEnum;
 import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
 import org.openecomp.mso.properties.MsoPropertiesException;
 import org.openecomp.mso.properties.MsoPropertiesFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <br>
@@ -58,7 +58,7 @@
     /**
      * Log service
      */
-    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+    private static final Logger LOGGER =  LoggerFactory.getLogger(RestfulUtil.class);
 
     private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
 
@@ -83,7 +83,7 @@
                 msbPort = msoPropertiesFactory.getMsoJavaProperties("MSO_PROP_TOPOLOGY").getProperty("msb-port", DEFAULT_MSB_PORT);
             }
         } catch(MsoPropertiesException e) {
-            LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, "Get msb properties failed",e);
+            LOGGER.error("Get msb properties failed",e);
             e.printStackTrace();
         }
         return "http://" + msbIp + ":" + msbPort;
@@ -95,7 +95,7 @@
 
     public static RestfulResponse send(String url, String methodType, String content) {
         String msbUrl = getMsbHost() + url;
-        LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.openecomp.mso.adapters.vfc.util.RestfulUtil","VFC Adapter");
+        LOGGER.info("Begin to sent message " + methodType +": " + msbUrl);
 
         HttpRequestBase method = null;
         HttpResponse httpResponse = null;
@@ -196,12 +196,12 @@
     }
 
     private static void logError(String errMsg, Throwable t) {
-        LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
+        LOGGER.error(errMsg, t);
         ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
     }
 
     private static void logError(String errMsg) {
-        LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
+        LOGGER.error(errMsg);
         ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
     }
 
