Skip to content

Commit

Permalink
stop logging big documents at error level (#2577)
Browse files Browse the repository at this point in the history
  • Loading branch information
austin007008 committed Sep 30, 2024
1 parent e8c4ead commit 68f070a
Showing 1 changed file with 2 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,27 +210,8 @@ public Attribute<?> toDocKeyAttributes(Set<Key> docKeys, boolean keepRecordId) {
}

public void debugDocumentSize(Key docKey) {
long bytes = sizeInBytes();
// if more than 100M, then error
if (bytes > (ONE_HUNDRED_M)) {
log.error("Document " + docKey + "; size = " + size() + "; bytes = " + bytes);
}
// if more than 10M, then warn
// else if (bytes > (1024l * 1000 * 10)) {
// log.warn("Document " + docKey + "; size = " + size() + "; bytes = " + bytes);
// }

// if more than 1M, then info
else if (bytes > (ONE_M)) {
log.info("Document " + docKey + "; size = " + size() + "; bytes = " + bytes);
}
// if more than 500K, then debug
else if (bytes > (FIVE_HUNDRED_K) && log.isDebugEnabled()) {
log.debug("Document " + docKey + "; size = " + size() + "; bytes = " + bytes);
}
// trace everything
else if (log.isTraceEnabled()) {
log.trace("Document " + docKey + "; size = " + size() + "; bytes = " + bytes);
if (log.isDebugEnabled()) {
log.debug("Document " + docKey + "; size = " + size() + "; bytes = " + sizeInBytes());
}
}

Expand Down

0 comments on commit 68f070a

Please sign in to comment.