org.pentaho.di.core.logging
Class LogWriter

java.lang.Object
  extended by org.pentaho.di.core.logging.LogWriter

public class LogWriter
extends Object

This class handles the logging.

Since:
25-04-2003
Author:
Matt

Field Summary
static String STRING_PENTAHO_DI_CONSOLE_APPENDER
           
static String STRING_PENTAHO_DI_LOGGER_NAME
           
 
Method Summary
 void addAppender(org.apache.log4j.Appender appender)
           
 boolean close()
           
static void closeAndRemoveFileAppender()
          Closes the file appender opened by the getInstance(filename, exact, level) method
static Log4jFileAppender createFileAppender(String filename, boolean exact)
          Create a file appender
static Log4jFileAppender createFileAppender(String filename, boolean exact, boolean append)
          Create a file appender
static String createFileAppenderName(String filename, boolean exact)
           
static Log4jStringAppender createStringAppender()
          Deprecated. Please use CentralLogStore.getAppender() instead. This uses a central logging buffer in stead of a distributed one. It also supports incremental buffer gets, and much more.
 org.apache.commons.vfs.FileObject getFileAppenderFile()
          This is not thread safe: please try to get the file appender yourself using the static constructor and work from there
 InputStream getFileInputStream()
          This is not thread safe: please try to get the file appender yourself using the static constructor and work from there
 FileInputStream getFileInputStream(String filename, boolean exact)
          Get the file input stream for a certain appender.
 String getFilter()
           
static LogWriter getInstance()
           
static LogWriter getInstance(String filename, boolean exact)
          Get a new log instance for the specified file if it is not open yet!
static org.apache.log4j.Layout getLayout()
           
 File getRealFilename()
           
 int getType()
           
 void println(LogMessageInterface logMessage, LogLevel channelLogLevel)
           
 void println(LogMessageInterface message, Throwable e, LogLevel channelLogLevel)
           
 void removeAppender(org.apache.log4j.Appender appender)
           
static void setConsoleAppenderDebug()
           
 void setFilter(String filter)
           
static void setLayout(org.apache.log4j.Layout layout)
           
 void setRealFilename(File realFilename)
           
 void setType(int type)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STRING_PENTAHO_DI_LOGGER_NAME

public static final String STRING_PENTAHO_DI_LOGGER_NAME
See Also:
Constant Field Values

STRING_PENTAHO_DI_CONSOLE_APPENDER

public static final String STRING_PENTAHO_DI_CONSOLE_APPENDER
See Also:
Constant Field Values
Method Detail

getInstance

public static final LogWriter getInstance()

getInstance

public static final LogWriter getInstance(String filename,
                                          boolean exact)
                                   throws KettleException
Get a new log instance for the specified file if it is not open yet!

Parameters:
filename - The log file to open
exact - is this an exact filename (false: prefix of name in temp directory)
Returns:
the LogWriter object
Throws:
KettleException

closeAndRemoveFileAppender

public static final void closeAndRemoveFileAppender()
Closes the file appender opened by the getInstance(filename, exact, level) method


createFileAppender

public static final Log4jFileAppender createFileAppender(String filename,
                                                         boolean exact)
                                                  throws KettleFileException
Create a file appender

Parameters:
filename - The (VFS) filename (URL) to write to.
exact - is this an exact filename of a filename to be stored in "java.io.tmp"
Returns:
A new file appender
Throws:
KettleFileException - In case there is a problem opening the file.

createFileAppender

public static final Log4jFileAppender createFileAppender(String filename,
                                                         boolean exact,
                                                         boolean append)
                                                  throws KettleFileException
Create a file appender

Parameters:
filename - The (VFS) filename (URL) to write to.
exact - is this an exact filename of a filename to be stored in "java.io.tmp"
append -
Returns:
A new file appender
Throws:
KettleFileException - In case there is a problem opening the file.

createFileAppenderName

public static final String createFileAppenderName(String filename,
                                                  boolean exact)

createStringAppender

public static final Log4jStringAppender createStringAppender()
Deprecated. Please use CentralLogStore.getAppender() instead. This uses a central logging buffer in stead of a distributed one. It also supports incremental buffer gets, and much more.

Returns:
a new String appender object capable of capturing the log stream. It starts to work the instant you add this appender to the Kettle logger.

setConsoleAppenderDebug

public static void setConsoleAppenderDebug()

getType

public int getType()

setType

public void setType(int type)

close

public boolean close()

println

public void println(LogMessageInterface logMessage,
                    LogLevel channelLogLevel)
Parameters:
logMessage -
channelLogLevel -

println

public void println(LogMessageInterface message,
                    Throwable e,
                    LogLevel channelLogLevel)

setFilter

public void setFilter(String filter)

getFilter

public String getFilter()

getFileInputStream

public InputStream getFileInputStream()
                               throws IOException
This is not thread safe: please try to get the file appender yourself using the static constructor and work from there

Throws:
IOException

getFileAppenderFile

public org.apache.commons.vfs.FileObject getFileAppenderFile()
                                                      throws IOException
This is not thread safe: please try to get the file appender yourself using the static constructor and work from there

Throws:
IOException

getFileInputStream

public FileInputStream getFileInputStream(String filename,
                                          boolean exact)
                                   throws IOException
Get the file input stream for a certain appender. The appender is looked up using the filename

Parameters:
filename - The exact filename (with path: c:\temp\logfile.txt) or just a filename (spoon.log)
exact - true if this is the exact filename or just the last part of the complete path.
Returns:
The file input stream of the appender
Throws:
IOException - in case the appender ocan't be found

getRealFilename

public File getRealFilename()
Returns:
Returns the realFilename.

setRealFilename

public void setRealFilename(File realFilename)
Parameters:
realFilename - The realFilename to set.

addAppender

public void addAppender(org.apache.log4j.Appender appender)

removeAppender

public void removeAppender(org.apache.log4j.Appender appender)

setLayout

public static void setLayout(org.apache.log4j.Layout layout)

getLayout

public static org.apache.log4j.Layout getLayout()