All available options are defined as static String-constants in JDBCAppender named xxx_OPTION.
1. Database-options to connect to the database
- URL_OPTION : a database url of the form jdbc:subprotocol:subname
- USERNAME_OPTION : the database user on whose behalf the connection is being made
- PASSWORD_OPTION : the user's password
2. Connector-option to specify your own JDBCConnectionHandler
- CONNECTOR_OPTION : a classname which is implementing the JDBCConnectionHandler-interface
This interface is used to get a customized connection.
If in addition the database-options are given, these options will be used as arguments for the JDBCConnectionHandler-interface to get a connection.
Else if no database-options are given, the JDBCConnectionHandler-interface is called without them.
Else if this option is not defined, the database-options are required to open a connection by the JDBCAppender.
3. SQL-option to specify a static sql-statement which will be performed with every occuring message-event
- SQL_OPTION : a sql-statement which will be used to write to the database
Use the variable @MSG@ on a location in the statement, which has to be dynamically replaced by the message-text.
If you give this option, the table-option and columns-option will be ignored !
4. Table-option to specify a table contained by the database
- TABLE_OPTION : the table in which the logging will be done
5. Columns-option to describe the important columns of the table (Not nullable columns are mandatory to describe!)
- COLUMNS_OPTION : a formatted list of column-descriptions
Each column description consists of
- the name of the column (required)
- a logtype which is a static constant of class LogType (required)
- and a value which depends by the LogType (optional/required, depending by logtype)
Here is a description of the available logtypes of class {@link LogType} and how to handle the value:
o MSG = a value will be ignored, the column will get the message. (One columns need to be of this type!)
o STATIC = the value will be filled into the column with every logged message. (Ensure that the type of value can be casted into the sql-type of the column!)
o ID = value must be a classname, which implements the JDBCIDHandler-interface.
o TIMESTAMP = a value will be ignored, the column will be filled with a actually timestamp with every logged message.
o EMPTY = a value will be ignored, the column will be ignored when writing to the database (Ensure to fill not nullable columns by a database trigger!)
If there are more than one column to describe, the columns must be separated by a Tabulator-delimiter (unicode0008) !
The arguments of a column-description must be separated by the delimiter '~' !
(Example : name1~logtype1~value1 name2~logtype2~value2...)
6. Layout-options to define the layout of the messages (optional)
- _ : the layout wont be set by a xxx_OPTION
See the configuration-file and code examples below...
The default is a layout of the class {@link org.apache.log4j.PatternLayout} with the pattern=%m which representate only the message.
7. Buffer-option to define the size of the message-event-buffer (optional)
- BUFFER_OPTION : define how many messages will be buffered until they will be updated to the database.
The default is buffer=1, which will do a update with every happened message-event.
8. Commit-option to define a auto-commitment
- COMMIT_OPTION : define whether updated messages should be committed to the database (Y) or not (N).
The default is commit=Y.