org.jcoderz.commons.logging
Class MessageLineFormat

java.lang.Object
  extended by org.jcoderz.commons.logging.LogLineFormat
      extended by org.jcoderz.commons.logging.BasicLogLineFormat
          extended by org.jcoderz.commons.logging.MessageLineFormat
Direct Known Subclasses:
ErrorLineFormat

public class MessageLineFormat
extends BasicLogLineFormat

This class formats and parses log lines for instances of type Loggable.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jcoderz.commons.logging.LogLineFormat
LogLineFormat.LogLineType
 
Field Summary
 
Fields inherited from class org.jcoderz.commons.logging.BasicLogLineFormat
NUMBER_OF_PARAMETERS
 
Fields inherited from class org.jcoderz.commons.logging.LogLineFormat
EMPTY_FORMATTERS, ERROR_MESSAGE, EXCEPTION_MESSAGE, LOG_MESSAGE, NESTED_MESSAGE, PARAMETER_LINE, SOURCECLASS_INDEX, SOURCEMETHOD_INDEX, STACKTRACE_MESSAGE, TRACE_MESSAGE
 
Constructor Summary
protected MessageLineFormat(LogLineFormat.LogLineType type)
          Creates a new instance of this and sets the supplied line type specifier.
 
Method Summary
 void format(StringBuffer sb, LogRecord record, Loggable loggable, List trackingIdSequence, Throwable thrown, Object parameter)
          Formats a Loggable into the supplied StringBuffer.
protected  String getMessageText()
          Gets the message text of a parsed log line.
 void parse(StringBuffer sb, LogFileEntry entry)
          Parses a log line, which must be formatted by this, and sets the appropriate values of the supplied LogFileEntry.
protected  void setMessageText(String text)
          Sets the message to format.
 
Methods inherited from class org.jcoderz.commons.logging.BasicLogLineFormat
basicFormat, basicParse, getBasicFormatList, getBusinessImpact, getCategory, getInstanceId, getLevel, getMessageId, getNodeId, getThreadId, getThreadName, getTimestamp, getTrackingIds, setBusinessImpact, setCategory, setInstanceId, setLevel, setMessageId, setNodeId, setThreadId, setThreadName, setTimestamp, setTrackingIds
 
Methods inherited from class org.jcoderz.commons.logging.LogLineFormat
format, getBusinessImpactFormat, getCategoryFormat, getInstanceIdFormat, getLoggerLevelFormat, getLogLineType, getLogSource, getMessageSymbolFormat, getNodeIdFormat, getParameter, getThreadIdFormat, getThreadNameFormat, getTimestampFormat, getTrackingNumberFormat, parse, setFormats, setParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageLineFormat

protected MessageLineFormat(LogLineFormat.LogLineType type)
Creates a new instance of this and sets the supplied line type specifier. This might be used by more specialized sub classes of this.

Parameters:
type - The line type specifier to set.
Method Detail

format

public void format(StringBuffer sb,
                   LogRecord record,
                   Loggable loggable,
                   List trackingIdSequence,
                   Throwable thrown,
                   Object parameter)
Formats a Loggable into the supplied StringBuffer. Appends a line feed after the data is formatted into the StringBuffer.

Specified by:
format in class LogLineFormat
Parameters:
sb - The StringBuffer where to append the formatted Loggable.
record - Unused by this, might be null.
loggable - The Loggable to format.
trackingIdSequence - The list containing the sequence of tracking ids contributing to this log message.
thrown - Unused by this, might be null.
parameter - Unused by this, might be null.
See Also:
LogLineFormat.format(StringBuffer, LogRecord, Loggable, List, Throwable, Object)

parse

public void parse(StringBuffer sb,
                  LogFileEntry entry)
           throws ParseException
Parses a log line, which must be formatted by this, and sets the appropriate values of the supplied LogFileEntry.

Specified by:
parse in class LogLineFormat
Parameters:
sb - The StringBuffer containing the current log line.
entry - The LogFileEntry for which to parse the log line.
Throws:
ParseException - if an error occurs parsing sb.
See Also:
LogLineFormat.parse(java.lang.StringBuffer, org.jcoderz.commons.logging.LogFileEntry)

setMessageText

protected final void setMessageText(String text)
Sets the message to format. If the supplied string is null or empty, a space is set.

Parameters:
text - The message text.

getMessageText

protected final String getMessageText()
Gets the message text of a parsed log line.

Returns:
Message text of parsed log line.


Copyright 2007 The jCoderZ Project.