logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Burns" <frankbu...@the-hub.demon.co.uk>
Subject Urgent help needed with JDBCAppender
Date Fri, 16 Jul 2004 15:33:01 GMT
I urgently need some help to fix database logging on a production box, on which the db connections
time out -- and logging stops!

So I wonder can you please help me with implementing the enhanced version of JDBCAppender
( from: http://www.mannhaupt.com/danko/projects/ ) with mySQL on Tomcat?

I have implemented database pooling for the database, so it is available to the app, via JNDI,
as java:comp/env/jdbc/AmxTrcResources.

Here is part of my log4j.properties file:

log4j.logger.sysadmin.logins.successful = DEBUG, R5
log4j.appender.R5=org.apache.log4j.jdbcplus.JDBCAppender
log4j.appender.R5.buffer=1
log4j.appender.R5.dbclass=com.mysql.jdbc.Driver
log4j.appender.R5.connector=com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection
log4j.appender.R5.Sql=INSERT INTO LogsLoginsSuccessful (Date, Logger, Priority, Message) VALUES
('@LAYOUT@', '@CAT@', '@PRIO@', '@MSG@')
log4j.appender.R5.threshold=DEBUG
log4j.appender.R5.layout=org.apache.log4j.PatternLayout
log4j.appender.R5.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS}
log4j.appender.R5.commit=true
log4j.appender.R5.quoteReplace=true

I think the problem is with this line:

    log4j.appender.R5.connector=com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection

The API documentation says that for "connector" I need to specify a JDBCConnectionHandler
/ JDBCPoolConnectionHandler, but where do I get one of these for mySQL?

I get this exception: 

log4j:ERROR JDBCAppender::configure()
java.lang.Exception: JDBCAppender::connect(), java.lang.InstantiationException:
com.mysql.jdbc.jdbc2.optional.MysqlPooledConnection
        at org.apache.log4j.jdbcplus.JDBCAppender.connect(JDBCAppender.java:879)
        at org.apache.log4j.jdbcplus.JDBCAppender.configure(JDBCAppender.java:897)
        at org.apache.log4j.jdbcplus.JDBCAppender.ready(JDBCAppender.java:819)
        at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:755)
        at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
        at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
        at org.apache.log4j.Category.callAppenders(Category.java:187)
        at org.apache.log4j.Category.forcedLog(Category.java:372)
        at org.apache.log4j.Category.warn(Category.java:1019)
...


Thanks,

Frank.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message