0

I have installed JNDI Hikaricp 2.4.1 oracle pool connection in tomcat 8.0.28. It works well, but I want to see all log level messages from Hikaricp. Now I only see INFO messages. How can I configure this in tomcat. I don't know a lot how tomcat and hikaricp log system works. This is my configuration:

I have added in $CATALINA_HOME\lib:

HikariCP-2.4.1.jar
javassist-3.20.0-GA.jar
slf4j-api-1.7.12.jar
slf4j-jdk14-1.7.12.jar
ojdbc6.jar

I have added in $CATALINA_HOME\conf\server.xml:

<GlobalNamingResources>
  <Resource name="jdbc/OracleHikari" auth="Container"
    factory="com.zaxxer.hikari.HikariJNDIFactory"
    type="javax.sql.DataSource"
    maximumPoolSize="5"
    connectionInitSql="SELECT 1 FROM dual"
    dataSource.implicitCachingEnabled="true" 
    dataSource.user="xxx"
    dataSource.password="yyy"
    dataSourceClassName="oracle.jdbc.pool.OracleDataSource"
    dataSource.url="jdbc:oracle:thin:@.... "
  />
</GlobalNamingResources>

I have added in $CATALINA_HOME\conf\context.xml:

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

I suppose that I have to add something in $CATALINA_HOME\conf\logging.properties, but I don't know what. I have tested with:

com.zaxxer.hikari.apache.juli.AsyncFileHandler.level = FINE
com.zaxxer.hikari.apache.juli.AsyncFileHandler.directory = 
   ${catalina.base}/logs
com.zaxxer.hikari.apache.juli.AsyncFileHandler.prefix = manager.

but doesn't work.

Thanks

user1151816
  • 187
  • 4
  • 13

2 Answers2

1

Bit of a late reply, but I was able to enable debug level logging to catalina.out by adding the jars you prescribe above, and adding the following entries to /conf/logging.properties:

com.zaxxer.hikari.level = FINEST

I now see messages like this in catalina.out

    26-Apr-2016 14:49:54.312 FINE [Hikari housekeeper (pool HikariPool-0)] com.zaxxer.hikari.pool.HikariPool.logPoolState Before cleanup    pool HikariPool-0 stats (total=10, active=0, idle=10, waiting=0)
    26-Apr-2016 14:49:54.312 FINE [Hikari housekeeper (pool HikariPool-0)] com.zaxxer.hikari.pool.HikariPool.logPoolState After cleanup     pool HikariPool-0 stats (total=10, active=0, idle=10, waiting=0)
    26-Apr-2016 14:49:54.609 FINE [http-nio-8080-exec-7] com.zaxxer.hikari.pool.PoolElf.resetConnectionState HikariPool-0 - Reset (nothing) on connection com.mysql.jdbc.JDBC4Connection@78e209fb
    26-Apr-2016 14:49:54.609 FINE [http-nio-8080-exec-9] com.zaxxer.hikari.pool.PoolElf.resetConnectionState HikariPool-0 - Reset (nothing) on connection com.mysql.jdbc.JDBC4Connection@491783a7
    26-Apr-2016 14:49:54.613 FINE [http-nio-8080-exec-7] com.zaxxer.hikari.pool.PoolElf.resetConnectionState HikariPool-0 - Reset (nothing) on connection com.mysql.jdbc.JDBC4Connection@78e209fb
Chris Alme
  • 81
  • 6
1

Please note that in Tomcat version 8.5.16, the output of this configuration is written to the file:

${CATALINA_HOME}/logs/catalina.date.log

Also, the above mentioned library:

javassist-3.20.0-GA.jar

Is not required.

Otherwise, the configuration detailed in this article does work.

ThisaruG
  • 3,222
  • 7
  • 38
  • 60
iic1tls
  • 63
  • 5