Class AbstractLogFormatter
- java.lang.Object
-
- edu.isi.pegasus.common.logging.format.AbstractLogFormatter
-
- All Implemented Interfaces:
LogFormatter
public abstract class AbstractLogFormatter extends java.lang.Object implements LogFormatter
The abstract formatter that implements all of the functions except the addEvent function- Version:
- $Revision$
- Author:
- Karan Vahi, Gaurang Mehta
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDEFAULT_KEYThe default key to use for logging messagesprotected java.lang.StringmProgramThe name of the program.protected java.util.Stack<Event>mStackThe Stack of event objects maintained internally
-
Constructor Summary
Constructors Constructor Description AbstractLogFormatter()The default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description LogFormatteradd(java.lang.String value)Add to the log message with just a value.LogFormatteradd(java.lang.String key, java.lang.String value)Add to the log message for the event on the top.abstract voidaddEvent(java.lang.String name, java.lang.String entityName, java.lang.String entityID)Adds the event that is to be associated with the log messages onto an internal stackjava.lang.StringcreateEntityHierarchyMessage(java.lang.String parentType, java.lang.String parentID, java.lang.String childIdType, java.util.Collection<java.lang.String> childIDs)Creates a log message that connects the parent entities with the children.java.lang.StringcreateLogMessage()Creates a log message with the contents of the internal log buffer.java.lang.StringcreateLogMessageAndReset()Creates a log message with the contents of the internal log buffer.java.lang.StringgetEndEventMessage()Creates the end message for the event on top of the stack.java.lang.StringgetEventName()Returns the name of event that is currently associated with the log messages and is on the top of the stackjava.lang.StringgetProgramName(java.lang.String name)Returns the program name for the software whose log statement are logged.java.lang.StringgetStartEventMessage()Creates the start message for the event on top of the internal stackEventpopEvent()Pop the event on top of the internal stack.voidsetProgramName(java.lang.String name)Sets the program name for the software whose log statement are logged.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.isi.pegasus.common.logging.LogFormatter
addEvent
-
-
-
-
Field Detail
-
DEFAULT_KEY
private static java.lang.String DEFAULT_KEY
The default key to use for logging messages
-
mProgram
protected java.lang.String mProgram
The name of the program.
-
mStack
protected java.util.Stack<Event> mStack
The Stack of event objects maintained internally
-
-
Method Detail
-
setProgramName
public void setProgramName(java.lang.String name)
Sets the program name for the software whose log statement are logged.- Specified by:
setProgramNamein interfaceLogFormatter- Parameters:
name-
-
getProgramName
public java.lang.String getProgramName(java.lang.String name)
Returns the program name for the software whose log statement are logged.- Specified by:
getProgramNamein interfaceLogFormatter- Parameters:
name-- Returns:
- name of the program
-
addEvent
public abstract void addEvent(java.lang.String name, java.lang.String entityName, java.lang.String entityID)Adds the event that is to be associated with the log messages onto an internal stack- Specified by:
addEventin interfaceLogFormatter- Parameters:
name- the name of the event to be associatedentityName- the primary entity that is associated with the event e.g. workflowentityID- the id of that entity.
-
popEvent
public Event popEvent()
Pop the event on top of the internal stack.- Specified by:
popEventin interfaceLogFormatter- Returns:
- event on top , else null
-
getEventName
public java.lang.String getEventName()
Returns the name of event that is currently associated with the log messages and is on the top of the stack- Specified by:
getEventNamein interfaceLogFormatter- Returns:
- name of the event.
-
getStartEventMessage
public java.lang.String getStartEventMessage()
Creates the start message for the event on top of the internal stack- Specified by:
getStartEventMessagein interfaceLogFormatter- Returns:
- start event message
-
getEndEventMessage
public java.lang.String getEndEventMessage()
Creates the end message for the event on top of the stack.- Specified by:
getEndEventMessagein interfaceLogFormatter- Returns:
- end event message
-
add
public LogFormatter add(java.lang.String value)
Add to the log message with just a value.- Specified by:
addin interfaceLogFormatter- Parameters:
value-- Returns:
- self-reference
-
add
public LogFormatter add(java.lang.String key, java.lang.String value)
Add to the log message for the event on the top.- Specified by:
addin interfaceLogFormatter- Parameters:
key-value-- Returns:
- Self-reference, so calls can be chained
-
createLogMessage
public java.lang.String createLogMessage()
Creates a log message with the contents of the internal log buffer.- Specified by:
createLogMessagein interfaceLogFormatter- Returns:
- the log message
-
createLogMessageAndReset
public java.lang.String createLogMessageAndReset()
Creates a log message with the contents of the internal log buffer. It then resets the buffer before returning the log message- Specified by:
createLogMessageAndResetin interfaceLogFormatter- Returns:
- log message.
-
createEntityHierarchyMessage
public java.lang.String createEntityHierarchyMessage(java.lang.String parentType, java.lang.String parentID, java.lang.String childIdType, java.util.Collection<java.lang.String> childIDs)Creates a log message that connects the parent entities with the children. For e.g. can we use to create the log messages connecting the jobs with the workflow they are part of.- Specified by:
createEntityHierarchyMessagein interfaceLogFormatter- Parameters:
parentType- the type of parent entityparentID- the id of the parent entitychildIdType- the type of children entitieschildIDs- Collection of children id's- Returns:
- the entity hierarchy message
-
-