I set up database logging with slf4j
and logback
. I use this configuration with postgresql
and sqlite
without any problem
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
<dataSource class="com.zaxxer.hikari.HikariDataSource">
<driverClassName>org.postgresql.Driver</driverClassName><!-- org.sqlite.JDBC-->
<jdbcUrl>jdbc.postgresql://host:port/db_name</jdbcUrl><!-- jdbc:sqlite:local/dir/path/db_name.db-->
<username>username</username>
<password>password</password>
</dataSource>
</connectionSource>
</appender>
Now I want to send all these logs to oracle db so I changed the config file respectively
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
<dataSource class="com.zaxxer.hikari.HikariDataSource">
<driverClassName>oracle.jdbc.driver.OracleDriver</driverClassName>
<jdbcUrl>jdbc:oracle:thin:blabal@x.x.x.x:port:oraserv</jdbcUrl>
<username>user</username>
<password>pass</password>
</dataSource>
</connectionSource>
<sqlDialect class="ch.qos.logback.core.db.dialect.OracleDialect" />
</appender>
But I got this error
15:45:05,832 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@25:76 - no applicable action for [sqlDialect], current ElementPath is [[configuration][appender][sqlDialect]]
15:45:05,837 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@26:16 - RuntimeException in Action for tag [appender] java.lang.IllegalStateException: DBAppender cannot function if the JDBC driver does not support getGeneratedKeys method *and* without a specific SQL dialect
I thought dialect configuration through xml would solve the problem, but nothing changed. Can you give me some advice to make it work with oracle?