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 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 grab
      includeGeneral - include general log lines
      from -
      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 grab
      includeGeneral - include general log lines
      from -
      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 grab
      includeGeneral - include general log lines
      from -
      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 grab
      includeGeneral - include general log lines
      from -
      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

      public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral)
    • getBuffer

      public StringBuffer getBuffer(String parentLogChannelId, boolean includeGeneral, int startLineNr)
    • 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

      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.
      Was used in a pair with getBufferLinesBefore(long).
    • getBufferLinesBefore

      @Deprecated public List<BufferLine> getBufferLinesBefore(long minTimeBoundary)
      Deprecated.
      Was used in a pair with removeBufferLines(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)