You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Narayanan, Shiva (MED, Compuware)" <Sh...@med.ge.com> on 2002/07/23 19:48:04 UTC
JDBCAppender - Column values
Hello All,
We have the following requirements. We have a table called "logMessage"
in Oracle.
Fields in the table are
Emp_id --> Char data type
Session_id --> Char data type
Emp_name --> Char data type
Transaction_type--> Char data type
Transaction_timestamp --> Date data type
Result_code --> Number data type
Result_description --> Char data type
We need to log messages to the above table whenever a transaction is
complete.
How do we have to setup JDBCAppender to achieve this?
Many thanks,
Shiva
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: JDBCAppender - Column values
Posted by Kevin Steppe <ks...@pacbell.net>.
LogEvents don't have fields for those items, and the JDBCAppender logs
LogEvent objects. So you'll have to do some coding.
A couple options off the top of my hand:
1) extend PatternLayout with conversion characters for all those things
2) override getLogStatement(...) in JDBCAppender.
3) create your log message specifically for logging to the db, with
commas and such embedded. Then tell the JDBCAppender to insert just the
message.
example: log.info(" 'empABC', 'sessionABC', 'John', 'transABC',
'2002-07-23', 5, 'Result' ");
config: log4j.myjdbcappender.sql = insert into logMessage (Emp_id,
Session_id, ...) values (%m)
Kevin
Narayanan, Shiva (MED, Compuware) wrote:
>Hello All,
>We have the following requirements. We have a table called "logMessage"
>in Oracle.
>
>Fields in the table are
> Emp_id --> Char data type
> Session_id --> Char data type
> Emp_name --> Char data type
> Transaction_type--> Char data type
> Transaction_timestamp --> Date data type
> Result_code --> Number data type
> Result_description --> Char data type
>
>We need to log messages to the above table whenever a transaction is
>complete.
>How do we have to setup JDBCAppender to achieve this?
>
>Many thanks,
>Shiva
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>