log4j2 jdbc appender with sql function

Viewed 97

I am changing log4j1.x jdbc appender to log4j2.x jdbc appenders. Following is the appender in 1.x. in log4j.properties file:

->

log4j.appender.SAMPLE.sql=INSERT INTO SHOP VALUES(TO_TIMESTAMP_TZ('%d{ISO8601}','YYYY-MM-DD HH24:MI:SS,FF3'),TRIM('%.1000m'))-->insert query

Here SAMPLE is the customized jdbc appender

Following is the sql create query:

CREATE TABLE SHOP (DATED  TIMESTAMP NOT NULL, MESSAGE VARCHAR(1000)  NOT NULL)

I have used log4j2 columnMapping as follows:

appender.db.ColumnMapping[0].type = Column
appender.db.ColumnMapping[0].name = DATED
appender.db.ColumnMapping[0].isEventTimestamp = true

appender.db.ColumnMapping[1].type = Column
appender.db.ColumnMapping[1].name = MESSAGE
appender.db.ColumnMapping[1].pattern ="%.1000m"

these are the columnmappings used

Have to use the sql functions like 'TRIM', 'TO_TIMESTAMP_TZ' in this log4j2 jdbc appender. What is the solution?

0 Answers
Related