title: Logging with log4j in a mysql database using connection pool
body: <p>I have implemented a connection pool from JDBC to get and close connections for my data access objects in order to store and retrieve data from a mysql database with java. </p>
  
  <p>I also wanted to store the main operations and exceptions in the database with a library called log4j through its appender called JDBCAppender. </p>
  
  <p>before using the connection pool the logging of the events was fine since only one connection at a time was being utilized for operations. Now that the connections are simultaneously being grabbed from the pool and handed back to the pool, the logger doesnt seem to know how to get another connection once one connection (the first) is being closed. </p>
  
  <p>How can I log into the database having a connection pool?</p>
  
  <p>I have investigated in this myself and all I need to do is to override the getConnection() method in the JDBCAppender.java (which is in the apache log4j 1.2.16 library) ... but I have two questions. </p>
  
  <p>Do i need to have my connection pool implementation class in the LOG4J 1.2.16 jar file?
  Say if i get the connection from the pool, how do i recompile the LOG4J 1.2.16 Java files  into a jar file?</p>
  
  <p>With what you have read so far i can provide with the my connection pool implementation and the JDBCAppender java class and we can take it from there ... </p>