org.castor.tools.log4j
Class CastorAppender
AppenderSkeleton
org.castor.tools.log4j.CastorAppender
public final class CastorAppender
extends AppenderSkeleton
The
CastorAppender
provides sending log events to a database.
Each append call adds the
LoggingEvent
to an
ArrayList
buffer. When the buffer is filled each log event is saved to the database.
DatabaseName,
BufferSize,
ColumnWidthClass,
ColumnWidthThread,
ColumnWidthMessage,
ColumnWidthStackTrace and
DuplicateCount are configurable options in the standard log4j ways.
$Id: TNSAddress.java,v 1.2 2006/08/08 14:42:48 holger Exp $- Holger West,
Syscon Ingenieurb?ro f?r Mess- und Datentechnik GmbH.
CastorAppender
public CastorAppender()
Default constructor.
append
public void append(LoggingEvent event)
Adds the event to the buffer. When full the buffer is flushed.
event
- The event to be logged.
close
public void close()
Closes the appender, flushing the buffer first then closing the query and database
if it is still open.
finalize
public void finalize()
Closes the appender before disposal.
flush
public static void flush()
When the program has ended all logger instances are destroyed. To save all data
which are still in the buffer, this method must be called. It saves all data from
all registered CastorAppender
.
As an alternative org.apache.log4j.LogManager.shutdown()
can be
called.
getBufferSize
public int getBufferSize()
Get the size of the buffer.
getColumnWidthClass
public int getColumnWidthClass()
Get the column width for class information.
- The column width for class information.
getColumnWidthMessage
public int getColumnWidthMessage()
Get the column width for message information.
- The column width for message information.
getColumnWidthStackTrace
public int getColumnWidthStackTrace()
Get the column width for stack trace information.
- The column width for stack trace information.
getColumnWidthThread
public int getColumnWidthThread()
Get the column width for tread information.
- The column width for thread information.
getDatabaseName
public String getDatabaseName()
Get the name of the database.
getDuplicateCount
public String getDuplicateCount()
Is duplicate count enabled?
true
if duplicate count is enabled, otherwise
false
.
requiresLayout
public boolean requiresLayout()
CastorAppender don't requires a layout.
true
if this appender require a layout, otherwise
false
.
setBufferSize
public void setBufferSize(int newBufferSize)
Set the size of the buffer.
newBufferSize
- New size of the buffer.
setColumnWidthClass
public void setColumnWidthClass(int columWidth)
Set the column width for class information.
columWidth
- The column width for class information.
setColumnWidthMessage
public void setColumnWidthMessage(int columWidth)
Set the column width for message information.
columWidth
- The column width for message information.
setColumnWidthStackTrace
public void setColumnWidthStackTrace(int columWidth)
Set the column width for stack trace information.
columWidth
- The column width for stack trace information.
setColumnWidthThread
public void setColumnWidthThread(int columWidth)
Set the column width for thread information.
columWidth
- The column width for thread information.
setDatabaseName
public void setDatabaseName(String name)
Set the name of the database.
name
- Name of the database.
setDuplicateCount
public void setDuplicateCount(String duplicateCount)
Set duplicate count.
duplicateCount
- Should duplicate count be enabled?
Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com