org.jcoderz.commons.logging
Class BasicLogLineFormat

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

public abstract class BasicLogLineFormat
extends LogLineFormat

This class is the base class for log formats formatting the main log line of the log message, which contains all fields required for CA Unicenter integration. All sub classes of this are required to use these fields at the index required by this, but are allowed to append additional fields.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jcoderz.commons.logging.LogLineFormat
LogLineFormat.LogLineType
 
Field Summary
protected static int NUMBER_OF_PARAMETERS
          The number of parameters of the basic format.
 
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 BasicLogLineFormat(LogLineFormat.LogLineType type, String additionalPattern, int numAdditionalParameters)
          Creates a new instance of this and initializes the message format.
 
Method Summary
protected  void basicFormat(StringBuffer sb, LogRecord record, Loggable loggable, List trackingIdSequence)
          Formats the supplied LogRecord with the encapsulated basic message format.
protected  void basicParse(StringBuffer sb, LogFileEntry entry)
          Parses a log line, which must be formatted by this, and sets the appropriate basic values of the supplied LogFileEntry.
protected static List getBasicFormatList(DisplayOptions options, boolean ignoreOptions)
          Gets the formats as array for formatting all elements of a basic log line.
protected  BusinessImpact getBusinessImpact()
          Gets the business impact of a parsed log line.
protected  Category getCategory()
          Gets the category of a parsed log line.
protected  String getInstanceId()
          Gets the instance id of a parsed log line.
protected  Level getLevel()
          Gets the log level of a parsed log line.
protected  String getMessageId()
          Gets the message id of a parsed log line.
protected  String getNodeId()
          Gets the node id of a parsed log line.
protected  long getThreadId()
          Gets the thread id of a parsed log line.
protected  String getThreadName()
          Gets the thread id of a parsed log line.
protected  Date getTimestamp()
          Gets the timestamp of a parsed log line.
protected  List getTrackingIds()
          Gets the sequence of tracking ids of a parsed log line.
protected  void setBusinessImpact(BusinessImpact impact)
          Sets the business impact from the message to dump.
protected  void setCategory(Category category)
          Sets the category to dump.
protected  void setInstanceId(String instanceId)
          Sets the instance id to dump.
protected  void setLevel(Level level)
          Sets the level of the message to dump,
protected  void setMessageId(String messageId)
          Sets the message id from the message to dump.
protected  void setNodeId(String nodeId)
          Sets the node id to dump.
protected  void setThreadId(long threadId)
          Sets the thread id from the message to dump.
protected  void setThreadName(String threadName)
          Sets the thread name from the message to dump.
protected  void setTimestamp(Date timestamp)
          Sets the timestamp.
protected  void setTrackingIds(List trackingIds)
          Sets the list of tracking ids to dump.
 
Methods inherited from class org.jcoderz.commons.logging.LogLineFormat
format, format, getBusinessImpactFormat, getCategoryFormat, getInstanceIdFormat, getLoggerLevelFormat, getLogLineType, getLogSource, getMessageSymbolFormat, getNodeIdFormat, getParameter, getThreadIdFormat, getThreadNameFormat, getTimestampFormat, getTrackingNumberFormat, parse, parse, setFormats, setParameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMBER_OF_PARAMETERS

protected static final int NUMBER_OF_PARAMETERS
The number of parameters of the basic format.

See Also:
Constant Field Values
Constructor Detail

BasicLogLineFormat

protected BasicLogLineFormat(LogLineFormat.LogLineType type,
                             String additionalPattern,
                             int numAdditionalParameters)
Creates a new instance of this and initializes the message format.

Parameters:
type - THe log line type.
additionalPattern - The pattern for additional fields not included by this. Must start with the desired delimiter before the first field.
numAdditionalParameters - The number of additional fields.
Method Detail

getBasicFormatList

protected static List getBasicFormatList(DisplayOptions options,
                                         boolean ignoreOptions)
Gets the formats as array for formatting all elements of a basic log line.

Parameters:
options - The display options specifying which fields to display. Will be ignored and might be null if ignoreOptions == true.
ignoreOptions - flag whether to ignore the supplied options and return the formats for all fields.
Returns:
List filled with formats for each selected field. Might be empty, never null.

basicFormat

protected final void basicFormat(StringBuffer sb,
                                 LogRecord record,
                                 Loggable loggable,
                                 List trackingIdSequence)
Formats the supplied LogRecord with the encapsulated basic message format. Data for additional fields has to be set before calling this. Appends a line feed after the data is formatted into the StringBuffer.

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.

basicParse

protected final void basicParse(StringBuffer sb,
                                LogFileEntry entry)
                         throws ParseException
Parses a log line, which must be formatted by this, and sets the appropriate basic values of the supplied LogFileEntry. Derived types might retrieve specific field values after this has been called.

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)

setTimestamp

protected final void setTimestamp(Date timestamp)
Sets the timestamp.

Parameters:
timestamp - The timestamp to set.

getTimestamp

protected final Date getTimestamp()
Gets the timestamp of a parsed log line.

Returns:
Timestamp of parsed log line.

setNodeId

protected final void setNodeId(String nodeId)
Sets the node id to dump.

Parameters:
nodeId - The node id to dump.

getNodeId

protected final String getNodeId()
Gets the node id of a parsed log line.

Returns:
Node id of parsed log line.

setInstanceId

protected final void setInstanceId(String instanceId)
Sets the instance id to dump.

Parameters:
instanceId - The instance id to dump.

getInstanceId

protected final String getInstanceId()
Gets the instance id of a parsed log line.

Returns:
Instance id of parsed log line.

setThreadId

protected final void setThreadId(long threadId)
Sets the thread id from the message to dump.

Parameters:
threadId - The thread id to dump.

getThreadId

protected final long getThreadId()
Gets the thread id of a parsed log line.

Returns:
Thread id of parsed log line.

setThreadName

protected final void setThreadName(String threadName)
Sets the thread name from the message to dump.

Parameters:
threadName - The thread name to dump.

getThreadName

protected final String getThreadName()
Gets the thread id of a parsed log line.

Returns:
Thread id of parsed log line.

setTrackingIds

protected final void setTrackingIds(List trackingIds)
Sets the list of tracking ids to dump.

Parameters:
trackingIds - The sequence of tracking ids to dump.

getTrackingIds

protected final List getTrackingIds()
Gets the sequence of tracking ids of a parsed log line.

Returns:
Sequence of tracking ids of parsed log line.

setLevel

protected final void setLevel(Level level)
Sets the level of the message to dump,

Parameters:
level - The log level of the message.

getLevel

protected final Level getLevel()
Gets the log level of a parsed log line.

Returns:
Log level of parsed log line.

setMessageId

protected final void setMessageId(String messageId)
Sets the message id from the message to dump.

Parameters:
messageId - The message id of the message.

getMessageId

protected final String getMessageId()
Gets the message id of a parsed log line.

Returns:
Message id of parsed log line.

setBusinessImpact

protected final void setBusinessImpact(BusinessImpact impact)
Sets the business impact from the message to dump.

Parameters:
impact - The business impact of the message.

getBusinessImpact

protected final BusinessImpact getBusinessImpact()
Gets the business impact of a parsed log line.

Returns:
Business impact of parsed log line.

setCategory

protected final void setCategory(Category category)
Sets the category to dump.

Parameters:
category - The category of the message to dump.

getCategory

protected final Category getCategory()
Gets the category of a parsed log line.

Returns:
Category of parsed log line.


Copyright 2007 The jCoderZ Project.