|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.log4j.jdbcplus.JDBCLogger
This class encapsulate the logic which is necessary to log into a table. Used by JDBCAppender
Field Summary | |
protected String |
layoutPartsDelimiter
character to separate parts of layout if more than one part is to be used |
protected boolean |
usePreparedStatements
Defines whether to use Prepared Statements instead of updateable result sets (default false) |
Constructor Summary | |
JDBCLogger()
|
Method Summary | |
void |
append(LoggingEvent event,
Layout layout)
Writes a message into the database table. |
void |
appendSQL(LoggingEvent aEvent,
Layout layout)
Writes a message into the database using a given sql-statement. |
void |
freeConnection()
Description of the Method |
String |
getErrorMsg()
Return the internal error message stored in instance variable msg. |
String |
getLayoutPartsDelimiter()
|
String |
getProcedure()
|
int |
getThrowableMaxChars()
|
String |
getThrowableRepresentationFromLoggingEvent(LoggingEvent aLoggingEvent)
Extracts Stack trace of Throwable contained in LogginEvent, if there is any |
protected String |
getTokenFromList(List tokenList,
int index)
|
protected List |
getTokenList(String t_layout)
create token list from layout string |
boolean |
isCommit()
|
boolean |
isConfigured()
Return true, if this class is configured, else false. |
boolean |
isConnected()
Return true, if this connection is open, else false. |
boolean |
isQuoteReplace()
|
boolean |
isUsePreparedStatements()
|
boolean |
prepareConnection()
prepare connection |
boolean |
ready()
Return true, if this class is ready to append(), else false. |
String |
replace(String source,
int start,
int end,
int replacement)
int-replacer |
String |
replace(String source,
int start,
int end,
String replacement)
String-replacer |
String |
replace(String source,
String find,
int replacement)
int-replacer |
String |
replace(String source,
String find,
String replacement)
String-replacer |
void |
setCommit(boolean b)
|
void |
setConnection(Object obj)
Sets a connection. |
void |
setLayoutPartsDelimiter(String c)
|
void |
setLogType(String _name,
int _logtype,
Object _value)
Sets a columns logtype (LogTypes) and value, which depends on that logtype. |
void |
setProcedure(String procedure,
ArrayList columns)
|
void |
setQuoteReplace(boolean b)
|
void |
setSQL(String _sql)
Configures this class, by storing and parsing the given sql-statement. |
void |
setSqlHandler(JDBCSqlHandler sqlHandler)
Sets the SqlHandler attribute of the JDBCLogger object |
void |
setTable(String _table)
Configures this class, by reading in the structure of the log-table Throws an exception, if an database-error occurs ! |
void |
setThrowableMaxChars(int throwableMaxChars)
|
void |
setUsePreparedStatements(boolean usePreparedStatements)
|
void |
tryToFreeConnection()
Calls freeConnection but catches all raising exceptions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String layoutPartsDelimiter
protected boolean usePreparedStatements
Constructor Detail |
public JDBCLogger()
Method Detail |
public void setConnection(Object obj) throws Exception
obj
- The new Connection value
Exception
- Description of Exceptionpublic void setSqlHandler(JDBCSqlHandler sqlHandler) throws Exception
sqlHandler
- The new SqlHandler value
Exception
- Description of Exceptionpublic void setLogType(String _name, int _logtype, Object _value) throws Exception
_name
- The new JDBCLogType value_logtype
- The new JDBCLogType value_value
- The new JDBCLogType value
Exception
- Description of Exceptionpublic void setTable(String _table) throws Exception
_table
- Description of Parameter
Exception
- Description of Exceptionpublic void setSQL(String _sql) throws Exception
_sql
- Description of Parameter
Exception
- Description of Exceptionpublic boolean isConfigured()
public boolean isConnected()
public String getErrorMsg()
public void freeConnection() throws Exception
Exception
- Description of Exceptionpublic void tryToFreeConnection()
freeConnection
but catches all raising exceptions.
freeConnection()
public boolean prepareConnection() throws Exception
Exception
- Description of Exceptionpublic void append(LoggingEvent event, Layout layout) throws Exception
event
- the LoggingEvent to loglayout
- layout to use for message
Exception
- Description of Exceptionpublic void appendSQL(LoggingEvent aEvent, Layout layout) throws Exception
layout
- layout to use for message
Exception
- Description of Exceptionprotected String getTokenFromList(List tokenList, int index) throws Exception
tokenList
- index
- list index, 1-based.
Exception
protected List getTokenList(String t_layout)
t_layout
-
public boolean ready()
public String replace(String source, String find, String replacement)
source
- Description of Parameterfind
- Description of Parameterreplacement
- Description of Parameter
public String replace(String source, String find, int replacement)
source
- Description of Parameterfind
- Description of Parameterreplacement
- Description of Parameter
public String replace(String source, int start, int end, String replacement)
source
- Description of Parameterstart
- Description of Parameterend
- Description of Parameterreplacement
- Description of Parameter
public String replace(String source, int start, int end, int replacement)
source
- Description of Parameterstart
- Description of Parameterend
- Description of Parameterreplacement
- Description of Parameter
public String getThrowableRepresentationFromLoggingEvent(LoggingEvent aLoggingEvent)
aLoggingEvent
- logging event
public boolean isCommit()
public void setCommit(boolean b)
b
- public boolean isQuoteReplace()
public void setQuoteReplace(boolean b)
b
- public String getLayoutPartsDelimiter()
public void setLayoutPartsDelimiter(String c)
c
- public boolean isUsePreparedStatements()
public void setUsePreparedStatements(boolean usePreparedStatements)
usePreparedStatements
- The usePreparedStatements to set.public String getProcedure()
public void setProcedure(String procedure, ArrayList columns) throws Exception
procedure
- The procedure to set.columns
- columns
Exception
public int getThrowableMaxChars()
public void setThrowableMaxChars(int throwableMaxChars)
throwableMaxChars
- The throwableMaxChars to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |