• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

StatementFinalizer context.xml logging configuration

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello fellow ranchers!   Trying to track down an Oracle open cursor issue with statementfinalizer and logabandonded=true logging.  I added the logging to context.xml and server.xml. But I am not seeing any new logs or additional logging.  Hoping someone can help me out.

Context.xml


server.xml




 
Bartender
Posts: 20980
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you are planning to share that connection pool between multiple webapps, you would define it in the context.xml file, not the server.xml file.

And actually, I'm kind of confused here, since it looks like you have 2 pool definitions, one with a long JNDI resource pathname and one with a more conventional one.

Plus I didn't actually see a logAbandoned setting in the server.xml defined pool, although maybe it wrapped out of sight.

You will not see any extra logs telling you about having abandoned connections logged. Instead what happens is that when your application pulls a Connection from the monitored pool, an Exception object is created, marking the callback stack at the moment the connection was obtained. This Exception is then saved in a secret hiding place.

Periodically, the pool will check its checked-out Connections to see if they have been held longer than the allowable time. If so, then that saved Exception will be reported in the Tomcat stdout (catalina,out) log. The effect would be something like this:


Actual connection pool error-handling code and message text will vary, but the net effect is like that.
 
Quincy Schmidt
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Unless you are planning to share that connection pool between multiple webapps, you would define it in the context.xml file, not the server.xml file.

And actually, I'm kind of confused here, since it looks like you have 2 pool definitions, one with a long JNDI resource pathname and one with a more conventional one.

Plus I didn't actually see a logAbandoned setting in the server.xml defined pool, although maybe it wrapped out of sight.

You will not see any extra logs telling you about having abandoned connections logged. Instead what happens is that when your application pulls a Connection from the monitored pool, an Exception object is created, marking the callback stack at the moment the connection was obtained. This Exception is then saved in a secret hiding place.

Periodically, the pool will check its checked-out Connections to see if they have been held longer than the allowable time. If so, then that saved Exception will be reported in the Tomcat stdout (catalina,out) log. The effect would be something like this:


Actual connection pool error-handling code and message text will vary, but the net effect is like that.




Thank you for the reply Tim!

These webapp servers are in a farm.  

In the server.xml you can see logabanded bolded below.  Or am I missing another piece to it?

<Resource auth="Container" connectionProperties="includeSynonyms=true" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" >
       driverClassName="oracle.jdbc.OracleDriver" maxActive="25" maxIdle="3" maxTotal="25" logAbandoned="true"


Also does the statementfinalizer in the context.xml look correct?  And can I do all this with the generic ojdbc7.jar driver or if I need the oracle logging enabled driver?

 
Tim Holloway
Bartender
Posts: 20980
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Being in a farm doesn't promote a Connection pool from context.xml to server.xml. The only time you'd put Connection Pool definitions in server.xml is if they were shared between multiple webapps within that server, and that's independent of whether the server is in a "farm" (cluster?) or sitting all alone in Antarctica.

Your last definition is a dead resource. It has no name, so nothing can do a JNDI lookup to find it and use it.

I have never found it necessary to use an Interceptor on a JDBC Connection Pool in Tomcat. And don't see the need for one to monitor abandoned connections unless you are looking for specific detailed information that the standard monitor cannot provide. Everything here seems too complex.

As far as I know, abandoned Connection monitoring is done by the JDBC Connection Pool software itself, since it's the same function whether you're running Oracle or you're running Microsoft SQL Server. So it shouldn't matter which Oracle JDBC driver you use.
 
Hold that thought. Tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!