2

I am using a JDBC appender in which I wrote a sql query which logs into the table with table structure as shown

Column name  Null  Type
------------ ----- -----------------
DATED              DATE
LEVEL1             VARCHAR2(10)
MESSAGE            VARCHAR2(1000)
TIME               TIMESTAMP(5)
LOGGER             VARCHAR2(25)
MODULE             VARCHAR2(75)
USER1              VARCHAR2(35)
OBJ_ID             VARCHAR2(25)

and the entry in my log4j.properties file for the query is

log4j.appender.DB.sql=INSERT INTO LOGS VALUES('%d{dd-MMM-yy}','%p','%m','%d{dd-MMM-yy HH:mm:ss}','%C','%t','username','obid')

I want the USER and OBJ_ID column values to be passed through a java file into log4j.properties.

How can this be done?

Tim Down
  • 318,141
  • 75
  • 454
  • 536
User 4.5.5
  • 1,311
  • 3
  • 12
  • 20

1 Answers1

0

You can use the log4j MDC as described here or here. This basically gives you a variable %X{user1} and so on in log4j.properties.

Community
  • 1
  • 1
barfuin
  • 16,865
  • 10
  • 85
  • 132