Package org.pentaho.di.core.logging
Class LoggingRegistry
java.lang.Object
org.pentaho.di.core.logging.LoggingRegistry
This class keeps track of all LoggingObjects that implement the LoggingObjectInterface which register with the
LoggingRegistry. It is a static singleton, and manages the in memory LoggingObjects as well as LoggingObjects that
have FileWriter Buffers.
The class provides a central and thread safe place to register, remove and find LoggingObjects held in memory.
It uses a purgeTimer task to attempt to remove older registry objects as the internal map reaches the maxSize which
is defined by the Kettle Property "KETTLE_MAX_LOGGING_REGISTRY_SIZE".
-
Method Summary
Modifier and TypeMethodDescriptiondump
(boolean includeGeneral) Returns the contents of the Registry map as a string.findExistingLoggingSource
(LoggingObjectInterface loggingObject) Finds an Existing LoggingObjectInterface in the registry using the LoggingObject's equals method.static LoggingRegistry
getLogChannelChildren
(String parentLogChannelId) Searches for a LogChannel and returns a list of children IDs.Searches and returns LogChannelFileWriterBuffer object based on buffer's LogChannelID.Returns a Set of LogChannelIds associated with a FileWriterBuffer which includes a parent and its children.getLoggingObject
(String logChannelId) Returns a LoggingObjectInterface based on a LogChannelID which is the key for the LoggingRegistry.getMap()
Deprecated.This is unsafe call and references to this method will be removed.void
registerLogChannelFileWriterBuffer
(LogChannelFileWriterBuffer fileWriterBuffer) Registers a LogChannelFileWriterBuffer with the registry.registerLoggingSource
(Object object) Register Method for objects that implement the LoggingObjectInterface which adds them to the LoggingRegistry.registerLoggingSource
(Object object, boolean isPurgeable) Register Method for objects that implement the LoggingObjectInterface which adds them to the LoggingRegistry, Includes a flag to identify loggingObjects that should not be removed from the registry i.e.void
removeIncludingChildren
(String logChannelId) Removes a LoggingObject entry and all its children, based on a LogChannelID.void
Removes a LogChannelFileWriterBuffer by LogChannelId.void
Cleans up internal map of children that do not have parent in the main registry map.void
reset()
Resets all internal memory objects and counters.void
Schedule the Purge Timer.void
Updates Class variables from the systemProperties / kettle.properties.
-
Method Details
-
getInstance
-
registerLoggingSource
Register Method for objects that implement the LoggingObjectInterface which adds them to the LoggingRegistry. Note, this defaults the object to be purged by the registry.- Parameters:
object
- the object to register.- Returns:
- the LogChanelID which is a String UUID key.
-
registerLoggingSource
Register Method for objects that implement the LoggingObjectInterface which adds them to the LoggingRegistry, Includes a flag to identify loggingObjects that should not be removed from the registry i.e. Singleton classes or "General" that stick around the life of the application.- Parameters:
object
- the object to register.isPurgeable
- true will flag the object to be purged if needed.- Returns:
- the LogChanelID which is a String UUID key.
-
findExistingLoggingSource
Finds an Existing LoggingObjectInterface in the registry using the LoggingObject's equals method.- Parameters:
loggingObject
- the object to search for.- Returns:
- the LoggingObjectInterface if found, null otherwise.
-
getLoggingObject
Returns a LoggingObjectInterface based on a LogChannelID which is the key for the LoggingRegistry.- Parameters:
logChannelId
- the logChannelID to search for.- Returns:
- the LoggingObjectInterface if found, null otherwise.
-
getMap
Deprecated.This is unsafe call and references to this method will be removed. -
updateFromProperties
public void updateFromProperties()Updates Class variables from the systemProperties / kettle.properties. -
schedulePurgeTimer
public void schedulePurgeTimer()Schedule the Purge Timer. -
getLogChannelChildren
Searches for a LogChannel and returns a list of children IDs.- Parameters:
parentLogChannelId
- The ID of the parent to search for.- Returns:
- a list of LogChannelID's that are the children of the parent object (parent also included on the list).
-
getLastModificationTime
- Returns:
- Last Modification Time of the registry.
-
dump
Returns the contents of the Registry map as a string.- Parameters:
includeGeneral
- Flag when true includes LoggingObjects of type GENERAL.- Returns:
- String containing logging object.
-
removeIncludingChildren
Removes a LoggingObject entry and all its children, based on a LogChannelID.- Parameters:
logChannelId
- LogChannelID of the parent object to remove.
-
removeOrphans
public void removeOrphans()Cleans up internal map of children that do not have parent in the main registry map. -
registerLogChannelFileWriterBuffer
Registers a LogChannelFileWriterBuffer with the registry. Existing Buffer must have a logChannelID set.- Parameters:
fileWriterBuffer
- Object to register.
-
getLogChannelFileWriterBuffer
Searches and returns LogChannelFileWriterBuffer object based on buffer's LogChannelID.- Parameters:
id
- LogChannelID to search for.- Returns:
- Buffer Object, null if can't be determined.
-
getLogChannelFileWriterBufferIds
Returns a Set of LogChannelIds associated with a FileWriterBuffer which includes a parent and its children.- Returns:
- A set of LogChannelIds to avoid duplicates.
-
removeLogChannelFileWriterBuffer
Removes a LogChannelFileWriterBuffer by LogChannelId.- Parameters:
id
- LogChannelId of the object to remove.
-
reset
public void reset()Resets all internal memory objects and counters.
-