I'm trying to use Logback's DBAppender开发者_C百科. My logback.xml has the following appender:
</appender>
<appender name="DatabaseAppender" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
<driverClass>oracle.jdbc.OracleDriver</driverClass>
<url>jdbc:oracle:thin:@HOST_URL:PORT:SERVICE_NAME</url>
<user>USER</user>
<password>PASS</password>
</connectionSource>
</appender>
the url given works with other java classes in the same project but it fails with logback giving the following error
ORA-00904: "ARG3": invalid identifier
at java.sql.SQLException: ORA-00904: "ARG3": invalid identifier
where ARG3 is the <url>jdbc:oracle:thin:@HOST_URL:PORT:SERVICEID</url>
I'd be interested in the Oracle statement resulting in this error. My guess is that it is trying an INSERT INTO table (arg1, arg2, arg3) values (...); when the table doesn't contain that column.
If you don't know what the table is then checking here about forcing an error dump when the 904 error is encountered.
I can do a
ALTER system SET EVENTS '904 TRACE NAME ERRORSTACK LEVEL 3';
Then, when the error is raised, the database generates a trace file which should show the problem statement similar to the following :
ORA-00904: "FRFRF": invalid identifier
Current SQL statement for this session:
select frfrf from dual
FOR DATASOURCE CONNECTIONS:
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource
class="ch.qos.logback.core.db.DataSourceConnectionSource">
<dataSource
class="com.mchange.v2.c3p0.ComboPooledDataSource">
<driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
<jdbcUrl>jdbc:oracle:thin:@localhost:1521:XE</jdbcUrl>
<user>system</user>
<password>a</password>
</dataSource>
</connectionSource>
</appender>
FOR DRIVERMANAGER CONNECTIONS:
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
<driverClass>com.mysql.jdbc.Driver</driverClass>
<url>jdbc:mysql://host_name:3306/datebase_name</url>
<user>username</user>
<password>password</password>
</connectionSource>
</appender>
精彩评论