From: Jozef Gloncak Date: Fri, 15 May 2015 09:25:45 +0000 (+0200) Subject: Improving logging. X-Git-Tag: release/lithium~185^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=8b0231eca61b6b37b6dcb67fe1b4768395b9c7d6;p=openflowplugin.git Improving logging. Change-Id: Ic4b8d30eccbaf175f6352b775aa2f80f31c425b5 Signed-off-by: Jozef Gloncak --- diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/callback/BaseCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/callback/BaseCallback.java index 96ad46cc60..86b21e1213 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/callback/BaseCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/callback/BaseCallback.java @@ -51,13 +51,18 @@ public class BaseCallback implements FutureCallback> { deviceContext.unhookRequestCtx(getRequestContext().getXid()); // handle requestContext failure - StringBuilder rpcErrors = new StringBuilder(); - if (null != fRpcResult.getErrors() && fRpcResult.getErrors().size() > 0) { - for (RpcError error : fRpcResult.getErrors()) { - rpcErrors.append(error.getMessage()); + if (LOG.isTraceEnabled()) { + StringBuilder rpcErrors = new StringBuilder(); + if (null != fRpcResult.getErrors() && fRpcResult.getErrors().size() > 0) { + for (RpcError error : fRpcResult.getErrors()) { + rpcErrors.append(error.getMessage()); + LOG.trace("Errors from rpc result.. ",error); + } } + LOG.trace("OF Java result for XID {} was not successful. Errors : {}", getRequestContext().getXid().getValue(), rpcErrors.toString()); + } - LOG.trace("OF Java result for XID {} was not successful. Errors : {}", getRequestContext().getXid().getValue(), rpcErrors.toString()); + getRequestContext().getFuture().set( RpcResultBuilder.failed().withRpcErrors(fRpcResult.getErrors()).build()); RequestContextUtil.closeRequstContext(getRequestContext()); diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImpl.java index 569223daff..55114109d0 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalFlowServiceImpl.java @@ -122,6 +122,7 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService @Override public void onFailure(final Throwable throwable) { getMessageSpy().spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_FAILURE); + LOG.trace("Flow modification failed..", throwable); StringBuffer errors = new StringBuffer(); try { RpcResult result = future.get(); @@ -133,8 +134,9 @@ public class SalFlowServiceImpl extends CommonService implements SalFlowService } } catch (InterruptedException | ExecutionException e) { LOG.trace("Flow modification failed. Can't read errors from RpcResult."); + } finally { + LOG.trace("Flow modification failed. Errors : {}", errors.toString()); } - LOG.trace("Flow modification failed. Errors : {}", errors.toString()); } }); return future;