public static void logContentsInRange(final LmdbEnv env,
                                          final Dbi<ByteBuffer> dbi,
                                          final Txn<ByteBuffer> txn,
                                          final KeyRange<ByteBuffer> keyRange,
                                          final Function<ByteBuffer, String> keyToStringFunc,
                                          final Function<ByteBuffer, String> valueToStringFunc,
                                          final Consumer<String> logEntryConsumer) {

        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(LogUtil.message("Dumping entries in range {} [[{}] to [{}]] for database [{}]",
                keyRange.getType().toString(),
                ByteBufferUtils.byteBufferToHex(keyRange.getStart()),
                ByteBufferUtils.byteBufferToHex(keyRange.getStop()),
                new String(dbi.getName())));

        try (CursorIterable<ByteBuffer> cursorIterable = dbi.iterate(txn, keyRange)) {
            for (final CursorIterable.KeyVal<ByteBuffer> keyVal : cursorIterable) {
                stringBuilder.append(LogUtil.message("\n  key: [{}] - value [{}]",
                        keyToStringFunc.apply(keyVal.key()),
                        valueToStringFunc.apply(keyVal.val())));
            }
        }
        logEntryConsumer.accept(stringBuilder.toString());
    }
Only intended for use in tests as the DB could be massive and thus produce a LOT of logging
stroom-lmdb/src/main/java/stroom/lmdb/LmdbUtils.java