summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
3868a69)
Data trees and tree candidates can get quite large and fill up the
log files when debug is on and, worst case, cause OOM errors. For
debug logging, only print the whole tree/candidate with trace logging.
In cases where an Optional data tree is outputted via toString, only
output if the data tree is present or not.
Change-Id: I6cb5f9a5da9e3cc3218c83bb103b673db0fb1d80
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
- return super.addToStringAttributes(toStringHelper).add("alternates", alternates).add("dataTree", dataTree)
- .add("maxMessages", maxMessages);
+ return super.addToStringAttributes(toStringHelper).add("alternates", alternates)
+ .add("dataTree present", getDataTree().isPresent()).add("maxMessages", maxMessages);
- public void addToStringAttributes() throws Exception {
- final MoreObjects.ToStringHelper result = OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
- Assert.assertTrue(result.toString().contains("alternates=" + ALTERNATES));
- Assert.assertTrue(result.toString().contains("dataTree=" + TREE));
- Assert.assertTrue(result.toString().contains("maxMessages=" + MAX_MESSAGES));
+ public void addToStringAttributes() {
+ // Just verify it doesn't throw an exception.
+ OBJECT.addToStringAttributes(MoreObjects.toStringHelper(OBJECT));
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
return super.addToStringAttributes(toStringHelper).add("cookie", cookie).add("shard", shardName)
@Override
protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
return super.addToStringAttributes(toStringHelper).add("cookie", cookie).add("shard", shardName)
- .add("dataTree", dataTree.orElse(null));
+ .add("dataTree present", getDataTree().isPresent());
}
void canCommit(final DataTreeCandidate tip) throws ExecutionException, TimeoutException {
}
void canCommit(final DataTreeCandidate tip) throws ExecutionException, TimeoutException {
- LOG.debug("{}: canCommit - candidate: {}", txId, tip);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("{}: canCommit - candidate: {}", txId, tip);
+ } else {
+ LOG.debug("{}: canCommit - candidate rootPath: {}", txId, tip.getRootPath());
+ }
final List<CanCommit> messages = registry.createCanCommitMessages(txId, tip, schema);
LOG.debug("{}: canCommit - messages: {}", txId, messages);
final List<CanCommit> messages = registry.createCanCommitMessages(txId, tip, schema);
LOG.debug("{}: canCommit - messages: {}", txId, messages);
@Override
public void publishChanges(final DataTreeCandidate candidate) {
@Override
public void publishChanges(final DataTreeCandidate candidate) {
- LOG.debug("{}: publishChanges: {}", logContext, candidate);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("{}: publishChanges: {}", logContext, candidate);
+ } else {
+ LOG.debug("{}: publishChanges: rootPath: {}", logContext, candidate.getRootPath());
+ }
+
processCandidateTree(candidate);
}
processCandidateTree(candidate);
}