Holger's
Java API

com.antelmann.util.logging
Class DBLineLogFormatter

java.lang.Object
  extended by com.antelmann.util.logging.DBLineLogFormatter
All Implemented Interfaces:
LogEntryFormatter<String>

public class DBLineLogFormatter
extends Object
implements LogEntryFormatter<String>

formats a LogEntry into a format that can be easily imported into databases.

Author:
Holger Antelmann

Constructor Summary
DBLineLogFormatter()
           
DBLineLogFormatter(DateFormat df, String fieldSeparator, String lineSeparator, boolean useQuotes)
           
 
Method Summary
 String formatLogEntry(LogEntry entry)
          This method returns a one-line dif-like formattedd String of the entry terminated by a line separator.
 String getFieldSeparator()
           
 String getHeaderLine()
           
 String getLineSeparator()
           
 int getParamSize()
           
 DateFormat getTimeFormat()
           
 boolean isUseQuotes()
           
 void setFieldSeparator(String fieldSeparator)
           
 void setLineSeparator(String lineSeparator)
           
 void setParamSize(int paramSize)
           
 void setTimeFormat(DateFormat timeFormat)
           
 void setUseQuotes(boolean useQuotes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBLineLogFormatter

public DBLineLogFormatter()

DBLineLogFormatter

public DBLineLogFormatter(DateFormat df,
                          String fieldSeparator,
                          String lineSeparator,
                          boolean useQuotes)
Method Detail

getTimeFormat

public DateFormat getTimeFormat()

setTimeFormat

public void setTimeFormat(DateFormat timeFormat)

getFieldSeparator

public String getFieldSeparator()

setFieldSeparator

public void setFieldSeparator(String fieldSeparator)

getLineSeparator

public String getLineSeparator()

setLineSeparator

public void setLineSeparator(String lineSeparator)

isUseQuotes

public boolean isUseQuotes()

setUseQuotes

public void setUseQuotes(boolean useQuotes)

getParamSize

public int getParamSize()

setParamSize

public void setParamSize(int paramSize)

formatLogEntry

public String formatLogEntry(LogEntry entry)
This method returns a one-line dif-like formattedd String of the entry terminated by a line separator. The parameters are:
time, level, message, sourceClass, thrown, threadName, param1, param2, etc.
The time field is either written as milliseconds or as a String, depending on the value of the boolean member timeAsString of this class. At least one parameter field will be written, even if entry.parameters is null. If any value is null, empty quotations will be put instead of the String.

Specified by:
formatLogEntry in interface LogEntryFormatter<String>

getHeaderLine

public String getHeaderLine()


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads