Package org.pentaho.di.core.logging
Class LoggingBuffer
java.lang.Object
org.pentaho.di.core.logging.LoggingBuffer
This class keeps the last N lines in a buffer
- Author:
- matt
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLogggingEvent
(KettleLoggingEvent loggingEvent) void
void
clear()
void
close()
void
doAppend
(KettleLoggingEvent event) dump()
Deprecated.getBuffer
(String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr, int tailLines) getBuffer
(String parentLogChannelId, boolean includeGeneral, org.apache.commons.lang3.mutable.MutableInt newLastNr) This method also returns the last line number tapped to the sender in the form of a mutableIntDeprecated.getBufferLinesBefore
(long minTimeBoundary) Deprecated.int
getLogBufferFromTo
(String parentLogChannelId, boolean includeGeneral, int from, int to) getLogBufferFromTo
(String parentLogChannelId, boolean includeGeneral, int from, int to, int tailLines) getLogBufferFromTo
(List<String> channelId, boolean includeGeneral, int from, int to) getLogBufferFromTo
(List<String> channelId, boolean includeGeneral, int from, int to, int tailLines, String parentLogChannelId) int
getName()
int
void
removeBufferLines
(List<BufferLine> linesToRemove) Deprecated.in favor ofremoveBufferLinesBefore(long)
.void
removeBufferLinesBefore
(long minTimeBoundary) void
Removes all rows for the channel with the specified idvoid
void
boolean
void
setLayout
(KettleLogLayout layout) void
setMaxNrLines
(int maxNrLines) void
int
size()
-
Constructor Details
-
LoggingBuffer
public LoggingBuffer(int bufferSize)
-
-
Method Details
-
getLastBufferLineNr
public int getLastBufferLineNr()- Returns:
- the number (sequence, 1..N) of the last log line. If no records are present in the buffer, 0 is returned.
-
getLogBufferFromTo
public List<KettleLoggingEvent> getLogBufferFromTo(List<String> channelId, boolean includeGeneral, int from, int to) - Parameters:
channelId
- channel IDs to grabincludeGeneral
- include general log linesfrom
-to
-- Returns:
-
getLogBufferFromTo
public List<KettleLoggingEvent> getLogBufferFromTo(List<String> channelId, boolean includeGeneral, int from, int to, int tailLines, String parentLogChannelId) - Parameters:
channelId
- channel IDs to grabincludeGeneral
- include general log linesfrom
-to
-tailLines
- Limit output to the last {tailLines} lines if non-zero- Returns:
-
getLogBufferFromTo
public List<KettleLoggingEvent> getLogBufferFromTo(String parentLogChannelId, boolean includeGeneral, int from, int to) - Parameters:
parentLogChannelId
- the parent log channel ID to grabincludeGeneral
- include general log linesfrom
-to
-- Returns:
-
getLogBufferFromTo
public List<KettleLoggingEvent> getLogBufferFromTo(String parentLogChannelId, boolean includeGeneral, int from, int to, int tailLines) - Parameters:
parentLogChannelId
- the parent log channel ID to grabincludeGeneral
- include general log linesfrom
-to
-tailLines
- Limit output to the last {tailLines} lines, if non-zero- Returns:
-
getBuffer
public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr) -
getBuffer
public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr, int tailLines) -
getBuffer
-
getBuffer
-
getBuffer
public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral, org.apache.commons.lang3.mutable.MutableInt newLastNr) This method also returns the last line number tapped to the sender in the form of a mutableInt- Parameters:
parentLogChannelId
-includeGeneral
-newLastNr
- receives the starting line number, returns the getLastBufferLineNr() to the caller- Returns:
-
getBuffer
-
close
public void close() -
doAppend
-
setName
-
getName
-
setLayout
-
getLayout
-
requiresLayout
public boolean requiresLayout() -
clear
public void clear() -
getMaxNrLines
public int getMaxNrLines()- Returns:
- the maximum number of lines that this buffer contains, 0 or lower means: no limit
-
setMaxNrLines
public void setMaxNrLines(int maxNrLines) - Parameters:
maxNrLines
- the maximum number of lines that this buffer should contain, 0 or lower means: no limit
-
getNrLines
public int getNrLines()- Returns:
- the nrLines
-
removeChannelFromBuffer
Removes all rows for the channel with the specified id- Parameters:
id
- the id of the logging channel to remove
-
size
public int size() -
removeGeneralMessages
public void removeGeneralMessages() -
getBufferIterator
Deprecated.We should not expose iterator out of the class. Looks like it's only used in tests. Marked deprecated for now. TODO: To be made package-level in future. -
dump
Deprecated.It looks like this method is not used in the project. -
removeBufferLines
Deprecated.in favor ofremoveBufferLinesBefore(long)
.Was used in a pair withgetBufferLinesBefore(long)
. -
getBufferLinesBefore
Deprecated.in favor ofremoveBufferLinesBefore(long)
.Was used in a pair withremoveBufferLines(List)
. -
removeBufferLinesBefore
public void removeBufferLinesBefore(long minTimeBoundary) -
addLogggingEvent
-
addLoggingEventListener
-
removeLoggingEventListener
-
removeBufferLinesBefore(long)
.