0

What I want is to insert the log's information into a database using the weblogic database configuration ‘ModuleDs’ that why I use dbAppender. But when I try to test the log4j code the DBAppender class doesn’t got the query that I wrote and initialize it by a strange one :'INSERT INTO logging_event_property ... '

Here is my code .xml :

<appender name="CreerLog" class="org.apache.log4j.DBAppender"> <connectionSource class="org.apache.log4j.receivers.db.JNDIConnectionSource"> <param name="jndiLocation" value="moduleDS" /> </connectionSource> <param name="ConversionPattern" value="INSERT INTO FICHIERLOG ( ID, DATECREATION, CONTENUFICHIER) VALUES (BLT_FICHIERLOG_SEQ.nextval, SYSDATE, null)"/> </appender>

Y.Bofi
  • 83
  • 5
  • You're trying to insert sql via ConversionPattern, which is definitely not allowed. The param `ConversionPattern` refers to the formatting that you want the log message to have – Ishnark Apr 13 '17 at 16:56
  • Also, it appears I was wrong about conversion layout: Both this (http://stackoverflow.com/questions/6444683/log4j-database-appender) and this (http://www.randombugs.com/java/dbappender-log4j-12.html0 may help you. The second shows a use case of DBAppender in a log4j.properties file – Ishnark Apr 13 '17 at 17:13
  • The solution that you propose with jdbcAppender dosent give the possibility of using server's database config and u have to assign the driver name,password,username,each time u change the environement. – Y.Bofi Apr 26 '17 at 13:54

0 Answers0