org.pentaho.di.core.logging
Class Log4jBufferAppender

java.lang.Object
  extended by org.pentaho.di.core.logging.Log4jBufferAppender
All Implemented Interfaces:
org.apache.log4j.Appender

public class Log4jBufferAppender
extends Object
implements org.apache.log4j.Appender

This class keeps the last N lines in a buffer

Author:
matt

Constructor Summary
Log4jBufferAppender(int bufferSize)
           
 
Method Summary
 void addFilter(org.apache.log4j.spi.Filter filter)
           
 void clear()
           
 void clearFilters()
           
 void close()
           
 void doAppend(org.apache.log4j.spi.LoggingEvent event)
           
 String dump()
           
 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()
           
 org.apache.log4j.spi.ErrorHandler getErrorHandler()
           
 org.apache.log4j.spi.Filter getFilter()
           
 int getLastBufferLineNr()
           
 org.apache.log4j.Layout getLayout()
           
 List<org.apache.log4j.spi.LoggingEvent> getLogBufferFromTo(List<String> channelId, boolean includeGeneral, int from, int to)
           
 List<org.apache.log4j.spi.LoggingEvent> getLogBufferFromTo(String parentLogChannelId, boolean includeGeneral, int from, int to)
           
 int getMaxNrLines()
           
 String getName()
           
 int getNrLines()
           
 void removeChannelFromBuffer(String id)
          Removes all rows for the channel with the specified id
 void removeGeneralMessages()
           
 boolean requiresLayout()
           
 void setErrorHandler(org.apache.log4j.spi.ErrorHandler arg0)
           
 void setFilter(org.apache.log4j.spi.Filter filter)
           
 void setLayout(org.apache.log4j.Layout layout)
           
 void setMaxNrLines(int maxNrLines)
           
 void setName(String name)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log4jBufferAppender

public Log4jBufferAppender(int bufferSize)
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<org.apache.log4j.spi.LoggingEvent> 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<org.apache.log4j.spi.LoggingEvent> 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:

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()

addFilter

public void addFilter(org.apache.log4j.spi.Filter filter)
Specified by:
addFilter in interface org.apache.log4j.Appender

getFilter

public org.apache.log4j.spi.Filter getFilter()
Specified by:
getFilter in interface org.apache.log4j.Appender

clearFilters

public void clearFilters()
Specified by:
clearFilters in interface org.apache.log4j.Appender

close

public void close()
Specified by:
close in interface org.apache.log4j.Appender

doAppend

public void doAppend(org.apache.log4j.spi.LoggingEvent event)
Specified by:
doAppend in interface org.apache.log4j.Appender

setName

public void setName(String name)
Specified by:
setName in interface org.apache.log4j.Appender

getName

public String getName()
Specified by:
getName in interface org.apache.log4j.Appender

setErrorHandler

public void setErrorHandler(org.apache.log4j.spi.ErrorHandler arg0)
Specified by:
setErrorHandler in interface org.apache.log4j.Appender

getErrorHandler

public org.apache.log4j.spi.ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface org.apache.log4j.Appender

setLayout

public void setLayout(org.apache.log4j.Layout layout)
Specified by:
setLayout in interface org.apache.log4j.Appender

getLayout

public org.apache.log4j.Layout getLayout()
Specified by:
getLayout in interface org.apache.log4j.Appender

requiresLayout

public boolean requiresLayout()
Specified by:
requiresLayout in interface org.apache.log4j.Appender

setFilter

public void setFilter(org.apache.log4j.spi.Filter filter)

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

public Iterator<BufferLine> getBufferIterator()

dump

public String dump()