From 2cf157241dc0ce5045c26e2ad07d053a60b37822 Mon Sep 17 00:00:00 2001 From: Moiz Raja Date: Fri, 18 Mar 2016 12:29:50 -0700 Subject: [PATCH] Stop logging complete data tree on prepare/commit failure Sometimes the data tree modification is so large that just trying to create the buffer to hold the message can make the controller run out of memory. Plus it's rarely useful to have a log filled with data which obfuscates other important log messages. This patch still logs the data tree modification at trace level. Change-Id: I76bff9f7e836ee5eff347b0b77e2817f441ab953 Signed-off-by: Moiz Raja --- .../cluster/datastore/SimpleShardDataTreeCohort.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java index 7f1c6a0cb2..806329aa5b 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/SimpleShardDataTreeCohort.java @@ -77,7 +77,11 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { LOG.trace("Transaction {} prepared candidate {}", transaction, candidate); return VOID_FUTURE; } catch (Exception e) { - LOG.debug("Transaction {} failed to prepare", transaction, e); + if(LOG.isTraceEnabled()) { + LOG.trace("Transaction {} failed to prepare", transaction, e); + } else { + LOG.error("Transaction failed to prepare", e); + } return Futures.immediateFailedFuture(e); } } @@ -101,7 +105,11 @@ final class SimpleShardDataTreeCohort extends ShardDataTreeCohort { try { dataTree.getDataTree().commit(candidate); } catch (Exception e) { - LOG.error("Transaction {} failed to commit", transaction, e); + if(LOG.isTraceEnabled()) { + LOG.trace("Transaction {} failed to commit", transaction, e); + } else { + LOG.error("Transaction failed to commit", e); + } return Futures.immediateFailedFuture(e); } -- 2.36.6