org.jcoderz.commons.logging
Class LogItem

java.lang.Object
  extended by org.jcoderz.commons.logging.LogItem
Direct Known Subclasses:
LogElement, LogFileEntry

public abstract class LogItem
extends Object

This class is the base class of nested log information as it is used for displaying or transferring log messages.


Field Summary
static String INTERNAL_PARAMETER_PREFIX
          This is a prefix of an internal parameter of a log message, i.e. a parameter, which is not defined as parameter in the xml file.
 
Constructor Summary
LogItem()
           
 
Method Summary
 void addToParameters(String name, Object value)
          Adds a parameter with value to the stored parameters.
 void appendMessageLine(String messageLine)
          Appends a new line with supplied message text to the already stored message.
 BusinessImpact getBusinessImpact()
          Gets the business impact.
 Category getCategory()
          Gets the category.
 String getInstanceId()
          Gets the id of the instance which logged this.
 Level getLoggerLevel()
          Gets the logger level of this entry.
 String getMessage()
          Gets the message of this entry.
 LogItem getNestedItem()
          Gets the item nested to this.
 String getNodeId()
          Gets the id of the node which logged this.
 Set getParameterNames()
          Gets the parameter names of the parameters for this as unmodifiable Set.
 List getParameterValues(String parameterName)
          Gets the List of parameter values for the specified parameter name as unmodifiable List.
 LogItem getParentItem()
          Gets the log item which is parent to this.
 String getSolution()
          Gets a possible solution.
 String getSourceClass()
          Gets the name of the class where the message was logged.
 String getSourceMethod()
          Gets the name of the method where this was logged.
 List getStackTraceLines()
          Gets the list of stack trace linesstored by this.
 String getSymbol()
          Gets the message symbol.
 String getSymbolId()
          Gets the id of the message symbol in hex representation.
 long getThreadId()
          Gets the id of the thread which logged this.
 String getThreadName()
          Gets the thread name for this LogItem.
 Date getTimestamp()
          Gets the timestamp of when this was logged.
 String getTrackingNumber()
          Gets the tracking number of this.
 String getType()
          Returns the type of this, which is retrieved from the log line type.
 boolean isExceptionItem()
          Gets information whether this item stores an exception + stacktrace + cause description only.
 void reset()
          Used for resetting this to an initial state so that this object could be reused again.
 void setBusinessImpact(BusinessImpact businessImpact)
          Sets the business impact of this.
 void setCategory(Category category)
          Sets the category of this.
 void setInstanceId(String instanceId)
          Sets the instance id.
 void setLoggerLevel(Level logLevel)
          Sets the log level of this.
 void setMessage(String message)
          Sets the message text.
 void setNestedItem(LogItem nestedItem)
          Sets the supplied item as nested item for this and this as parent for the supplied item.
 void setNodeId(String nodeId)
          Sets the node id.
 void setParentItem(LogItem parentEntry)
          Sets the log item which is parent to this.
 void setSolution(String solution)
          Sets the possible solution to resolve the error indicated by the logged message.
 void setSourceClass(String sourceClass)
          Sets the class name of the source location where the message was logged.
 void setSourceMethod(String sourceMethod)
          Sets the method name of the source location where the message was logged.
 void setSymbol(String symbol)
          Sets the message symbol.
 void setSymbolId(String symbolId)
          Sets the message symbol code.
 void setThreadId(long threadId)
          Sets the thread id.
 void setThreadName(String threadName)
          Sets the thread name for this LogItem.
 void setTimestamp(Date timestamp)
          Sets the timestamp of the message.
 void setTrackingNumber(String trackingNumber)
          Sets the tracking number from the parsed log line.
 void setType(String type)
          Sets the type of this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERNAL_PARAMETER_PREFIX

public static final String INTERNAL_PARAMETER_PREFIX
This is a prefix of an internal parameter of a log message, i.e. a parameter, which is not defined as parameter in the xml file.

See Also:
Constant Field Values
Constructor Detail

LogItem

public LogItem()
Method Detail

setBusinessImpact

public void setBusinessImpact(BusinessImpact businessImpact)
Sets the business impact of this.

Parameters:
businessImpact - The business impact to set.

setCategory

public void setCategory(Category category)
Sets the category of this.

Parameters:
category - The category to set.

setInstanceId

public void setInstanceId(String instanceId)
Sets the instance id.

Parameters:
instanceId - The instance id to set.

setLoggerLevel

public void setLoggerLevel(Level logLevel)
Sets the log level of this.

Parameters:
logLevel - The log level, which had been used for logging the message.

setMessage

public void setMessage(String message)
Sets the message text.

Parameters:
message - The text of the logged message.

appendMessageLine

public void appendMessageLine(String messageLine)
Appends a new line with supplied message text to the already stored message. If no message has been stored yet, the supplied string is set as message.

Parameters:
messageLine - The new line of message.

setNodeId

public void setNodeId(String nodeId)
Sets the node id.

Parameters:
nodeId - The node id to set.

setSolution

public void setSolution(String solution)
Sets the possible solution to resolve the error indicated by the logged message.

Parameters:
solution - The solution for the logged message.

setSourceClass

public void setSourceClass(String sourceClass)
Sets the class name of the source location where the message was logged.

Parameters:
sourceClass - The name of the class where the message was logged,

setSourceMethod

public void setSourceMethod(String sourceMethod)
Sets the method name of the source location where the message was logged.

Parameters:
sourceMethod - The name of the method where the message was logged,

setSymbol

public void setSymbol(String symbol)
Sets the message symbol.

Parameters:
symbol - The symbol for the logged message.

setSymbolId

public void setSymbolId(String symbolId)
Sets the message symbol code.

Parameters:
symbolId - The id/code for the symbol of the logged message.

setThreadId

public void setThreadId(long threadId)
Sets the thread id.

Parameters:
threadId - The thread id to set.

setTimestamp

public void setTimestamp(Date timestamp)
Sets the timestamp of the message.

Parameters:
timestamp - The timestamp of when the message was logged.

setTrackingNumber

public void setTrackingNumber(String trackingNumber)
Sets the tracking number from the parsed log line.

Parameters:
trackingNumber - The tracking number of the logged message.

setType

public void setType(String type)
Sets the type of this.

Parameters:
type - The type to set.

setThreadName

public void setThreadName(String threadName)
Sets the thread name for this LogItem.

Parameters:
type - The thread name to set..

getBusinessImpact

public BusinessImpact getBusinessImpact()
Gets the business impact.

Returns:
BusinessImpact of the message.

getCategory

public Category getCategory()
Gets the category.

Returns:
Category of the message.

getInstanceId

public String getInstanceId()
Gets the id of the instance which logged this.

Returns:
Id of instance, which logged this.

getLoggerLevel

public Level getLoggerLevel()
Gets the logger level of this entry.

Returns:
log level used to log this.

getMessage

public String getMessage()
Gets the message of this entry.

Returns:
Message text.

getNodeId

public String getNodeId()
Gets the id of the node which logged this.

Returns:
Id of the node qwhich logged this.

getParameterNames

public Set getParameterNames()
Gets the parameter names of the parameters for this as unmodifiable Set.

Returns:
Set with parameter names, migth be empty, never null.

getParameterValues

public List getParameterValues(String parameterName)
Gets the List of parameter values for the specified parameter name as unmodifiable List.

Parameters:
parameterName - The name of the parameter for which to return the values.
Returns:
List of parameter values, is null if parameterName is unknown.

getSolution

public String getSolution()
Gets a possible solution.

Returns:
The solution for an error message;

getSourceClass

public String getSourceClass()
Gets the name of the class where the message was logged.

Returns:
Name of the source class.

getSourceMethod

public String getSourceMethod()
Gets the name of the method where this was logged.

Returns:
Name of the source method.

getStackTraceLines

public List getStackTraceLines()
Gets the list of stack trace linesstored by this.

Returns:
List with stack trace lines, might be empty, never null.

getSymbol

public String getSymbol()
Gets the message symbol.

Returns:
The message symbol.

getSymbolId

public String getSymbolId()
Gets the id of the message symbol in hex representation.

Returns:
The symbol id in hex representation

getThreadId

public long getThreadId()
Gets the id of the thread which logged this.

Returns:
Id of thread whcih logged this.

getTimestamp

public Date getTimestamp()
Gets the timestamp of when this was logged.

Returns:
Timestamp when this was logged.

getTrackingNumber

public String getTrackingNumber()
Gets the tracking number of this.

Returns:
Tracking number of this.

getType

public String getType()
Returns the type of this, which is retrieved from the log line type.

Returns:
Type of this.

getThreadName

public String getThreadName()
Gets the thread name for this LogItem.

Returns:
The thread name of this log item.

isExceptionItem

public boolean isExceptionItem()
Gets information whether this item stores an exception + stacktrace + cause description only. Even if this is the case, there might be a nested item storing a log message.

Returns:
true, if this item only stores an exception; false, else.

getNestedItem

public LogItem getNestedItem()
Gets the item nested to this.

Returns:
nested log item, might be null if no such.

setNestedItem

public void setNestedItem(LogItem nestedItem)
Sets the supplied item as nested item for this and this as parent for the supplied item.

Parameters:
nestedItem - The LogItem to set as nested item for this.

setParentItem

public void setParentItem(LogItem parentEntry)
Sets the log item which is parent to this.

Parameters:
parentEntry - The parentEntry to set.

getParentItem

public LogItem getParentItem()
Gets the log item which is parent to this.

Returns:
The parent item of this, might be null.

addToParameters

public void addToParameters(String name,
                            Object value)
Adds a parameter with value to the stored parameters.

Parameters:
name - The name of the parameter.
value - The value of the parameter with this name.

reset

public void reset()
           throws LoggingException
Used for resetting this to an initial state so that this object could be reused again.

Throws:
LoggingException - if an error occurs.


Copyright 2007 The jCoderZ Project.