public final class CastorAppender
extends org.apache.log4j.AppenderSkeleton
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.
| Constructor and Description |
|---|
CastorAppender()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(org.apache.log4j.spi.LoggingEvent event)
Adds the event to the buffer.
|
void |
close()
Closes the appender, flushing the buffer first then closing the query and database
if it is still open.
|
void |
finalize()
Closes the appender before disposal.
|
static void |
flush()
When the program has ended all logger instances are destroyed.
|
int |
getBufferSize()
Get the size of the buffer.
|
int |
getColumnWidthClass()
Get the column width for class information.
|
int |
getColumnWidthMessage()
Get the column width for message information.
|
int |
getColumnWidthStackTrace()
Get the column width for stack trace information.
|
int |
getColumnWidthThread()
Get the column width for tread information.
|
java.lang.String |
getDatabaseName()
Get the name of the database.
|
java.lang.String |
getDuplicateCount()
Is duplicate count enabled?
|
boolean |
requiresLayout()
CastorAppender don't requires a layout.
|
void |
setBufferSize(int newBufferSize)
Set the size of the buffer.
|
void |
setColumnWidthClass(int columWidth)
Set the column width for class information.
|
void |
setColumnWidthMessage(int columWidth)
Set the column width for message information.
|
void |
setColumnWidthStackTrace(int columWidth)
Set the column width for stack trace information.
|
void |
setColumnWidthThread(int columWidth)
Set the column width for thread information.
|
void |
setDatabaseName(java.lang.String name)
Set the name of the database.
|
void |
setDuplicateCount(java.lang.String duplicateCount)
Set duplicate count.
|
public static void flush()
CastorAppender.
org.apache.log4j.LogManager.shutdown() can be
called.public void finalize()
finalize in class org.apache.log4j.AppenderSkeletonpublic void close()
close in interface org.apache.log4j.Appenderclose in class org.apache.log4j.AppenderSkeletonpublic void append(org.apache.log4j.spi.LoggingEvent event)
append in class org.apache.log4j.AppenderSkeletonevent - The event to be logged.public boolean requiresLayout()
requiresLayout in interface org.apache.log4j.AppenderrequiresLayout in class org.apache.log4j.AppenderSkeletontrue if this appender require a layout, otherwise
false.public void setBufferSize(int newBufferSize)
newBufferSize - New size of the buffer.public int getBufferSize()
public void setDatabaseName(java.lang.String name)
name - Name of the database.public java.lang.String getDatabaseName()
public void setColumnWidthClass(int columWidth)
columWidth - The column width for class information.public int getColumnWidthClass()
public void setColumnWidthThread(int columWidth)
columWidth - The column width for thread information.public int getColumnWidthThread()
public void setColumnWidthMessage(int columWidth)
columWidth - The column width for message information.public int getColumnWidthMessage()
public void setColumnWidthStackTrace(int columWidth)
columWidth - The column width for stack trace information.public int getColumnWidthStackTrace()
public void setDuplicateCount(java.lang.String duplicateCount)
duplicateCount - Should duplicate count be enabled?public java.lang.String getDuplicateCount()
true if duplicate count is enabled, otherwise
false.Intalio Inc. (C) 1999-2006. All rights reserved http://www.intalio.com