boolean forwards,
String customDumpReaderClass)
throws EnvironmentNotFoundException,
EnvironmentLockedException {
EnvironmentImpl env =
CmdUtil.makeUtilityEnvironment(envHome, true);
FileManager fileManager = env.getFileManager();
fileManager.setIncludeDeletedFiles(true);
int readBufferSize =
env.getConfigManager().getInt
(EnvironmentParams.LOG_ITERATOR_READ_SIZE);
/* Configure the startLsn and endOfFileLsn if reading backwards. */
long endOfFileLsn = DbLsn.NULL_LSN;
if (startLsn == DbLsn.NULL_LSN && endLsn == DbLsn.NULL_LSN &&
!forwards) {
LastFileReader fileReader =
new LastFileReader(env, readBufferSize);
while (fileReader.readNextEntry()) {
}
startLsn = fileReader.getLastValidLsn();
endOfFileLsn = fileReader.getEndOfLog();
}
try {
/*
* Make a reader. First see if a custom debug class is available,
* else use the default versions.
*/
DumpFileReader reader = null;
if (customDumpReaderClass != null) {
reader = getDebugReader(customDumpReaderClass, env,
readBufferSize, startLsn, endLsn,
endOfFileLsn, entryTypes, txnIds,
verbose, repEntriesOnly, forwards);
} else {
if (stats) {
reader = new StatsFileReader(env, readBufferSize, startLsn,
endLsn, endOfFileLsn,
entryTypes, txnIds, verbose,
repEntriesOnly, forwards);
} else {
reader = new PrintFileReader(env, readBufferSize, startLsn,
endLsn, endOfFileLsn,
entryTypes, txnIds, verbose,
repEntriesOnly, forwards);
}
}
/* Enclose the output in a tag to keep proper XML syntax. */
if (!csvFormat) {
System.out.println("<DbPrintLog>");
}
while (reader.readNextEntry()) {
}
reader.summarize(csvFormat);
if (!csvFormat) {
System.out.println("</DbPrintLog>");
}
} finally {
env.close();
}
}