org.jcoderz.commons.logging
Class TraceLineFormat

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

public class TraceLineFormat
extends BasicLogLineFormat

This formats a standard LogRecord and parses a log line with a formatted log record.


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 TraceLineFormat(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 the supplied LogRecord with the encapsulated message format.
protected  String[] getLogSource()
          Gets the source class name and source method name where the Log record was logged of a parsed log line.
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 setLogSource(String clazz, String method)
          Sets the log source as classname.methodname()
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

TraceLineFormat

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

Parameters:
type - The LineTypeSpecifier to set.
Method Detail

format

public void format(StringBuffer sb,
                   LogRecord record,
                   Loggable loggable,
                   List trackingIdSequence,
                   Throwable thrown,
                   Object parameter)
Formats the supplied LogRecord with the encapsulated message format. 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 LogRecord.
record - The LogRecord to format.
loggable - Unused by this, might be null.
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.
See Also:
LogLineFormat.parse(StringBuffer, 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.

setLogSource

protected final void setLogSource(String clazz,
                                  String method)
Sets the log source as classname.methodname()

Parameters:
clazz - The name of the class.
method - The name of the method.

getLogSource

protected final String[] getLogSource()
Gets the source class name and source method name where the Log record was logged of a parsed log line.

Returns:
String array with source class name as first and source method name as second parameter.


Copyright 2007 The jCoderZ Project.