[logback-user] Logging to Oracle with DBAppender and connection pooling doesn't work

Morten Egelund Rasmussen morten.egelund.rasmussen at gmail.com
Tue Oct 28 16:13:18 CET 2008


Hi all,

Does anybody have a working example on how to log to Oracle with a
connection pool on a Tomcat server?

I have the following:

In Tomcat's server.xml:

    <Resource name="jdbc/logger" auth="Container"
                  type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
                  url="foo"
                  username="foo" password="foobar"
                  maxActive="50" maxIdle="5"  initialSize="10"
                  maxWait="-1" removeAbandoned="true"
                  validationQuery="select 1 from dual"/>

In Tomcat's context.xml:

    <ResourceLink name="jdbc/logger"
                  global="jdbc/logger"
                  type="javax.sql.DataSource"/>

I have defined the following Logback appenders:

    <appender name="db" class="myAppenderClass">
        <connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
          <param name="jndiLocation" value="java:comp/env/jdbc/logger" />
        </connectionSource>
    </appender>

    <appender name="db2" class="myAppenderClass">
        <connectionSource
class="ch.qos.logback.core.db.DriverManagerConnectionSource">
            <driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
            <url>foo</url>
            <user>foo</user>
            <password>foobar</password>
        </connectionSource>
    </appender>

.....where "myAppenderClass" is an appender class as described here:
http://jira.qos.ch/browse/LBCORE-15

Using the "db" appender gives nothing, but using the "db2" appender
gives lots of output. What am I missing?

Any ideas?

~Morten :-/


More information about the Logback-user mailing list