synchronized (appenderFile.getFile()) {
LineNumberReader reader = null;
try {
reader = new LineNumberReader(new FileReader(appenderFile.getFile()));
LogLevel level = LogLevel.LEVEL_INFO;
String line;
// Skip lines that are below the offset
while (offset > (totalLinesCount + 1)) {
line = reader.readLine();
if (line == null) {
appenderFile.setLinesCount(reader.getLineNumber());
continue filesloop;
}
totalLinesCount++;
level = LogLevel.isolateLogLevel(line, 20, level);
}
int toLine = offset + size - 1;
// Read lines that are in the targeted region
while (totalLinesCount < toLine) {
line = reader.readLine();
if (line == null) {
appenderFile.setLinesCount(reader.getLineNumber());
continue filesloop;
}
totalLinesCount++;
level = LogLevel.isolateLogLevel(line, 20, level);
// Filter level
if (level.isHigherOrEqual(loglevel)) {
pageReached = true;
// Add line break only if not on first line
if (firstLine) {
firstLine = false;