Package org.pentaho.di.core.logging
Class LoggingBuffer
- java.lang.Object
-
- org.pentaho.di.core.logging.LoggingBuffer
-
public class LoggingBuffer extends Object
This class keeps the last N lines in a buffer- Author:
- matt
-
-
Constructor Summary
Constructors Constructor Description LoggingBuffer(int bufferSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addLogggingEvent(KettleLoggingEvent loggingEvent)
void
addLoggingEventListener(KettleLoggingEventListener listener)
void
clear()
void
close()
void
doAppend(KettleLoggingEvent event)
String
dump()
Deprecated.StringBuffer
getBuffer()
StringBuffer
getBuffer(String parentLogChannelId, boolean includeGeneral)
StringBuffer
getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr)
StringBuffer
getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr)
Iterator<BufferLine>
getBufferIterator()
Deprecated.List<BufferLine>
getBufferLinesBefore(long minTimeBoundary)
Deprecated.in favor ofremoveBufferLinesBefore(long)
.int
getLastBufferLineNr()
KettleLogLayout
getLayout()
List<KettleLoggingEvent>
getLogBufferFromTo(String parentLogChannelId, boolean includeGeneral, int from, int to)
List<KettleLoggingEvent>
getLogBufferFromTo(List<String> channelId, boolean includeGeneral, int from, int to)
int
getMaxNrLines()
String
getName()
int
getNrLines()
void
removeBufferLines(List<BufferLine> linesToRemove)
Deprecated.in favor ofremoveBufferLinesBefore(long)
.void
removeBufferLinesBefore(long minTimeBoundary)
void
removeChannelFromBuffer(String id)
Removes all rows for the channel with the specified idvoid
removeGeneralMessages()
void
removeLoggingEventListener(KettleLoggingEventListener listener)
boolean
requiresLayout()
void
setLayout(KettleLogLayout layout)
void
setMaxNrLines(int maxNrLines)
void
setName(String name)
int
size()
-
-
-
Method Detail
-
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(String parentLogChannelId, boolean includeGeneral, int from, int to)
- Parameters:
parentLogChannelId
- the parent log channel ID to grabincludeGeneral
- include general log linesfrom
-to
-- Returns:
-
getBuffer
public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr, int endLineNr)
-
getBuffer
public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral)
-
getBuffer
public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr)
-
getBuffer
public StringBuffer getBuffer()
-
close
public void close()
-
doAppend
public void doAppend(KettleLoggingEvent event)
-
setName
public void setName(String name)
-
getName
public String getName()
-
setLayout
public void setLayout(KettleLogLayout layout)
-
getLayout
public KettleLogLayout 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
public void removeChannelFromBuffer(String id)
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 public Iterator<BufferLine> 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 public String dump()
Deprecated.It looks like this method is not used in the project.
-
removeBufferLines
@Deprecated public void removeBufferLines(List<BufferLine> linesToRemove)
Deprecated.in favor ofremoveBufferLinesBefore(long)
.Was used in a pair withgetBufferLinesBefore(long)
.
-
getBufferLinesBefore
@Deprecated public List<BufferLine> getBufferLinesBefore(long minTimeBoundary)
Deprecated.in favor ofremoveBufferLinesBefore(long)
.Was used in a pair withremoveBufferLines(List)
.
-
removeBufferLinesBefore
public void removeBufferLinesBefore(long minTimeBoundary)
-
addLogggingEvent
public void addLogggingEvent(KettleLoggingEvent loggingEvent)
-
addLoggingEventListener
public void addLoggingEventListener(KettleLoggingEventListener listener)
-
removeLoggingEventListener
public void removeLoggingEventListener(KettleLoggingEventListener listener)
-
-