Class LogParser
java.lang.Object
org.apache.juneau.microservice.resources.LogParser
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- Iterable<LogParser.Entry>,- Iterator<LogParser.Entry>
public class LogParser
extends Object
implements Iterable<LogParser.Entry>, Iterator<LogParser.Entry>, Closeable
Utility class for reading log files.
 
Provides the capability of returning splices of log files based on dates and filtering based on thread and logger names.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionclassRepresents a single line from the log file.
- 
Constructor SummaryConstructors
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
LogParserpublic LogParser(LogEntryFormatter formatter, File f, Date start, Date end, String thread, String[] loggers, String[] severity) throws IOException Constructor.- Parameters:
- formatter- The log entry formatter.
- f- The log file.
- start- Don't return rows before this date. If- null , start from the beginning of the file.
- end- Don't return rows after this date. If- null , go to the end of the file.
- thread- Only return log entries with this thread name.
- loggers- Only return log entries produced by these loggers (simple class names).
- severity- Only return log entries with the specified severity.
- Throws:
- IOException- Thrown by underlying stream.
 
 
- 
- 
Method Details- 
hasNext- Specified by:
- hasNextin interface- Iterator<LogParser.Entry>
 
- 
next- Specified by:
- nextin interface- Iterator<LogParser.Entry>
 
- 
remove- Specified by:
- removein interface- Iterator<LogParser.Entry>
 
- 
iterator- Specified by:
- iteratorin interface- Iterable<LogParser.Entry>
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
- 
writeToSerializes the contents of the parsed log file to the specified writer and then closes the underlying reader.- Parameters:
- w- The writer to write the log file to.
- Throws:
- IOException- Thrown by underlying stream.
 
 
-