org.apache.turbine.services.logging.jdbc
Class JDBCAppender

java.lang.Object
  |
  +--org.apache.log4j.AppenderSkeleton
        |
        +--org.apache.turbine.services.logging.jdbc.JDBCAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class JDBCAppender
extends org.apache.log4j.AppenderSkeleton

The JDBCAppender, writes messages into a database. The JDBCAppender is configurable at runtime by setting options in two alternatives :

Author:
Thomas Fenner, Jason van Zyl

Field Summary
static java.lang.String LOGGER_CLASS_OPTION
          Logger class option.
static java.lang.String LOGGER_OPTION
          An option to set for the logger, these are name:value pairs that are used to initialize a logger.
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
JDBCAppender()
           
 
Method Summary
 void activateOptions()
          Active our logger to be used for appending messages to the database.
 void append(org.apache.log4j.spi.LoggingEvent event)
          Internal method.
 void close()
          Internal method.
 void finalize()
          If program terminates close the database-connection and flush the buffer.
 void flushBuffer()
          Internal method.
 java.lang.String[] getOptionStrings()
          Internal method.
 boolean isReady()
          Internal method.
 boolean requiresLayout()
          Internal method.
 void setOption(java.lang.String option, java.lang.String value)
          Sets all necessary options
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER_CLASS_OPTION

public static final java.lang.String LOGGER_CLASS_OPTION
Logger class option.

LOGGER_OPTION

public static final java.lang.String LOGGER_OPTION
An option to set for the logger, these are name:value pairs that are used to initialize a logger.
Constructor Detail

JDBCAppender

public JDBCAppender()
Method Detail

finalize

public void finalize()
If program terminates close the database-connection and flush the buffer.
Overrides:
finalize in class org.apache.log4j.AppenderSkeleton

getOptionStrings

public java.lang.String[] getOptionStrings()
Internal method. Returns a array of strings containing the available options which can be set with method setOption()

setOption

public void setOption(java.lang.String option,
                      java.lang.String value)
Sets all necessary options
Parameters:
String - option
String - value

activateOptions

public void activateOptions()
Active our logger to be used for appending messages to the database.
Overrides:
activateOptions in class org.apache.log4j.AppenderSkeleton

requiresLayout

public boolean requiresLayout()
Internal method. Returns true, you may define your own layout...
Overrides:
requiresLayout in class org.apache.log4j.AppenderSkeleton
Returns:
boolean

close

public void close()
Internal method. Close the database connection & flush the buffer.
Overrides:
close in class org.apache.log4j.AppenderSkeleton

append

public void append(org.apache.log4j.spi.LoggingEvent event)
Internal method. Appends the message to the database table.
Overrides:
append in class org.apache.log4j.AppenderSkeleton
Parameters:
LoggingEvent - event

flushBuffer

public void flushBuffer()
Internal method. Flushes the buffer.

isReady

public boolean isReady()
Internal method. Returns true, when the JDBCAppender is ready to append messages to the database, else false.
Returns:
boolean


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.