log4j | logging class member variables into oracle db | JDBCAppender.

S

siva

Hi.

I m fairly new to log4j and trying things out as part of a new
project. I m using JDBCAppender to log statements, and I have a
scenario where I want to post class member variables to the oracle
table.
for example.
I have oracle table defined as - ORA_SIGN_LOG
USER_NAME
PASSWORD
DATE_TIME_STAMP
MESSAGE

I want to supply values for the first 3fields from my java class (NOT
as part of the message as an object/) and able to log it to
corresponding fields in the table. I thought of putting as part of the
message and slicing it into pieces using sql in the log4j properties,
curious to know whether any inbuilt methodology from log4j. googled
with not much help.

Thanks in advance.
Sivaram
 
L

Lew

siva said:
Hi.

I m fairly new to log4j and trying things out as part of a new
project. I m using JDBCAppender to log statements, and I have a
scenario where I want to post class member variables to the oracle
table.
for example.
I have oracle table defined as - ORA_SIGN_LOG
USER_NAME
PASSWORD
DATE_TIME_STAMP
MESSAGE

I want to supply values for the first 3fields from my java class (NOT
as part of the message as an object/) and able to log it to
corresponding fields in the table. I thought of putting as part of the
message and slicing it into pieces using sql in the log4j properties,
curious to know whether any inbuilt methodology from log4j. googled
with not much help.

Be careful about doing too much in logging - you could wind up with exceptions
spewing from the logging action, that would then need to be logged, spewing
more exceptions, ...

Also, logging levels change in production - a sysadmin might raise or lower
the logging level as needed to diagnose situations. Be sure to account for that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top