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 int LOG_LEVEL_BASIC
           
static int LOG_LEVEL_DEBUG
           
static String[] log_level_desc_long
           
static int LOG_LEVEL_DETAILED
           
static int LOG_LEVEL_ERROR
           
static int LOG_LEVEL_MINIMAL
           
static int LOG_LEVEL_NOTHING
           
static int LOG_LEVEL_ROWLEVEL
           
static String[] logLevelDescription
           
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()
           
 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(int lvl)
           
static LogWriter getInstance(String filename, boolean exact, int level)
          Get a new log instance for the specified file if it is not open yet!
static org.apache.log4j.Layout getLayout()
           
 int getLogLevel()
           
static int getLogLevel(String lvl)
           
 String getLogLevelDesc()
           
static String getLogLevelDesc(int l)
           
 String getLogLevelLongDesc()
           
 File getRealFilename()
           
 int getType()
           
 boolean isBasic()
           
 boolean isDebug()
           
 boolean isDetailed()
           
 boolean isRowLevel()
           
 void logBasic(String subject, String message, Object... args)
           
 void logDebug(String subject, String message, Object... args)
           
 void logDetailed(String subject, String message, Object... args)
           
 void logError(String subject, String message, Object... args)
           
 void logError(String subject, String message, Throwable e)
           
 void logMinimal(String subject, String message, Object... args)
           
 void logRowlevel(String subject, String message, Object... args)
           
 void println(int lvl, String msg)
           
 void println(int lvl, String subj, String msg, Object... args)
           
 void removeAppender(org.apache.log4j.Appender appender)
           
static void setConsoleAppenderDebug()
           
 void setFilter(String filter)
           
static void setLayout(org.apache.log4j.Layout layout)
           
 void setLogLevel(int lvl)
           
 void setLogLevel(String lvl)
           
 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

LOG_LEVEL_NOTHING

public static final int LOG_LEVEL_NOTHING
See Also:
Constant Field Values

LOG_LEVEL_ERROR

public static final int LOG_LEVEL_ERROR
See Also:
Constant Field Values

LOG_LEVEL_MINIMAL

public static final int LOG_LEVEL_MINIMAL
See Also:
Constant Field Values

LOG_LEVEL_BASIC

public static final int LOG_LEVEL_BASIC
See Also:
Constant Field Values

LOG_LEVEL_DETAILED

public static final int LOG_LEVEL_DETAILED
See Also:
Constant Field Values

LOG_LEVEL_DEBUG

public static final int LOG_LEVEL_DEBUG
See Also:
Constant Field Values

LOG_LEVEL_ROWLEVEL

public static final int LOG_LEVEL_ROWLEVEL
See Also:
Constant Field Values

logLevelDescription

public static final String[] logLevelDescription

log_level_desc_long

public static final String[] log_level_desc_long

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

getInstance

public static final LogWriter getInstance(String filename,
                                          boolean exact,
                                          int level)
                                   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)
level - The log level
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()

setConsoleAppenderDebug

public static void setConsoleAppenderDebug()

getType

public int getType()

setType

public void setType(int type)

close

public boolean close()

setLogLevel

public void setLogLevel(int lvl)

setLogLevel

public void setLogLevel(String lvl)

getLogLevel

public int getLogLevel()

getLogLevelDesc

public String getLogLevelDesc()

getLogLevelLongDesc

public String getLogLevelLongDesc()

println

public void println(int lvl,
                    String msg)

println

public void println(int lvl,
                    String subj,
                    String msg,
                    Object... args)

logMinimal

public void logMinimal(String subject,
                       String message,
                       Object... args)

logBasic

public void logBasic(String subject,
                     String message,
                     Object... args)

logDetailed

public void logDetailed(String subject,
                        String message,
                        Object... args)

logDebug

public void logDebug(String subject,
                     String message,
                     Object... args)

logRowlevel

public void logRowlevel(String subject,
                        String message,
                        Object... args)

logError

public void logError(String subject,
                     String message,
                     Object... args)

logError

public void logError(String subject,
                     String message,
                     Throwable e)

setFilter

public void setFilter(String filter)

getFilter

public String getFilter()

getLogLevel

public static final int getLogLevel(String lvl)

getLogLevelDesc

public static final String getLogLevelDesc(int l)

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

isBasic

public boolean isBasic()

isDetailed

public boolean isDetailed()

isDebug

public boolean isDebug()

isRowLevel

public boolean isRowLevel()

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