Package org.apache.log4j.lf5.util
Class LogFileParser
- java.lang.Object
-
- org.apache.log4j.lf5.util.LogFileParser
-
- All Implemented Interfaces:
java.lang.Runnable
public class LogFileParser extends java.lang.Object implements java.lang.RunnableProvides utility methods for input and output streams.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.InputStream_in(package private) LogFactor5LoadingDialog_loadDialogprivate LogBrokerMonitor_monitorprivate static java.text.SimpleDateFormat_sdfstatic java.lang.StringATTRIBUTE_DELIMITERstatic java.lang.StringCATEGORY_DELIMITERstatic java.lang.StringDATE_DELIMITERstatic java.lang.StringLOCATION_DELIMITERstatic java.lang.StringMESSAGE_DELIMITERstatic java.lang.StringNDC_DELIMITERstatic java.lang.StringPRIORITY_DELIMITERstatic java.lang.StringRECORD_DELIMITERstatic java.lang.StringTHREAD_DELIMITER
-
Constructor Summary
Constructors Constructor Description LogFileParser(java.io.File file)LogFileParser(java.io.InputStream stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private LogRecordcreateLogRecord(java.lang.String record)private voiddestroyDialog()protected voiddisplayError(java.lang.String message)private java.lang.StringgetAttribute(int index, java.lang.String record)private java.lang.StringloadLogFile(java.io.InputStream stream)Loads a log file from a web server into the LogFactor5 GUI.voidparse(LogBrokerMonitor monitor)Starts a new thread to parse the log file and create a LogRecord.private java.lang.StringparseAttribute(java.lang.String name, java.lang.String record)private java.lang.StringparseCategory(java.lang.String record)private longparseDate(java.lang.String record)private java.lang.StringparseLocation(java.lang.String record)private java.lang.StringparseMessage(java.lang.String record)private java.lang.StringparseNDC(java.lang.String record)private LogLevelparsePriority(java.lang.String record)private java.lang.StringparseThread(java.lang.String record)private java.lang.StringparseThrowable(java.lang.String record)voidrun()Parses the file and creates new log records and adds the record to the monitor.
-
-
-
Field Detail
-
RECORD_DELIMITER
public static final java.lang.String RECORD_DELIMITER
- See Also:
- Constant Field Values
-
ATTRIBUTE_DELIMITER
public static final java.lang.String ATTRIBUTE_DELIMITER
- See Also:
- Constant Field Values
-
DATE_DELIMITER
public static final java.lang.String DATE_DELIMITER
- See Also:
- Constant Field Values
-
THREAD_DELIMITER
public static final java.lang.String THREAD_DELIMITER
- See Also:
- Constant Field Values
-
CATEGORY_DELIMITER
public static final java.lang.String CATEGORY_DELIMITER
- See Also:
- Constant Field Values
-
LOCATION_DELIMITER
public static final java.lang.String LOCATION_DELIMITER
- See Also:
- Constant Field Values
-
MESSAGE_DELIMITER
public static final java.lang.String MESSAGE_DELIMITER
- See Also:
- Constant Field Values
-
PRIORITY_DELIMITER
public static final java.lang.String PRIORITY_DELIMITER
- See Also:
- Constant Field Values
-
NDC_DELIMITER
public static final java.lang.String NDC_DELIMITER
- See Also:
- Constant Field Values
-
_sdf
private static java.text.SimpleDateFormat _sdf
-
_monitor
private LogBrokerMonitor _monitor
-
_loadDialog
LogFactor5LoadingDialog _loadDialog
-
_in
private java.io.InputStream _in
-
-
Constructor Detail
-
LogFileParser
public LogFileParser(java.io.File file) throws java.io.IOException, java.io.FileNotFoundException- Throws:
java.io.IOExceptionjava.io.FileNotFoundException
-
LogFileParser
public LogFileParser(java.io.InputStream stream) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
parse
public void parse(LogBrokerMonitor monitor) throws java.lang.RuntimeException
Starts a new thread to parse the log file and create a LogRecord. See run().- Parameters:
monitor- LogBrokerMonitor- Throws:
java.lang.RuntimeException
-
run
public void run()
Parses the file and creates new log records and adds the record to the monitor.- Specified by:
runin interfacejava.lang.Runnable
-
displayError
protected void displayError(java.lang.String message)
-
destroyDialog
private void destroyDialog()
-
loadLogFile
private java.lang.String loadLogFile(java.io.InputStream stream) throws java.io.IOExceptionLoads a log file from a web server into the LogFactor5 GUI.- Throws:
java.io.IOException
-
parseAttribute
private java.lang.String parseAttribute(java.lang.String name, java.lang.String record)
-
parseDate
private long parseDate(java.lang.String record)
-
parsePriority
private LogLevel parsePriority(java.lang.String record)
-
parseThread
private java.lang.String parseThread(java.lang.String record)
-
parseCategory
private java.lang.String parseCategory(java.lang.String record)
-
parseLocation
private java.lang.String parseLocation(java.lang.String record)
-
parseMessage
private java.lang.String parseMessage(java.lang.String record)
-
parseNDC
private java.lang.String parseNDC(java.lang.String record)
-
parseThrowable
private java.lang.String parseThrowable(java.lang.String record)
-
createLogRecord
private LogRecord createLogRecord(java.lang.String record)
-
getAttribute
private java.lang.String getAttribute(int index, java.lang.String record)
-
-