My problem is that I want to know how many connections are opened to the oracledb in an oracle datasource pool (oracle.jdbc.pool.OracleDataSource) and I want to print this information to the console using log4j.
I defined my pool in a spring configuration file:
<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" >
<property name="dataSourceName" value="ds" />
<property name="URL" value="jdbc:oracle:thin:@something" />
<property name="user" value="user" />
<property name="password" value="password" />
</bean>
I would pass somehow the log’s informations in my ojdbc6 or ojdbc14 jars to the console with log4j as I said but my log4j doesn’t print anything.
In my log4j.properties I have:
log4j.logger.oracle.jdbc.pool=ALL, jdbc
log4j.appender.jdbc=org.apache.log4j.ConsoleAppender
log4j.appender.jdbc.layout=org.apache.log4j.PatternLayout
log4j.appender.jdbc.layout.ConversionPattern=JDBC | %5p | %d{HH:mm:ss,SSS} > %m - [%l]%n
I don’t know if there are these kind of informations in ojdbc bundles, ok and if you know how can I have you’re welcome, but my problem is that I can’t see any logs. Maybe there aren’t any logs at all…
Thank you for your attention.
I found the answer, only some ojdbc bundles are able to print logs.
I have ojdbc6 and ojdbc14 jars and they haven’t this ability.
From this link.
When full logging is enabled, it is almost guaranteed that all sensitive information will be exposed in the log files. This is intrinsic to the logging feature. However, only certain JDBC JAR files include the JDBC logging feature. The following JAR files include full logging and should not be used in a sensitive environment:
The following JAR files include a limited logging capability:
I’m done 😛