Re: Cayenne Version 4.0 Logging

Andrus Adamchik <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <[email protected]>
Hi Keena,

You are using DBCP2 DataSource [1] in your app, specifically an instance of BasicDataSource [2].

I haven't used it myself, but quick code/javadocs inspection shows it has methods like "getNumActive()", etc. that should allow you to check its state at any moment in time. Also it can be monitored via JMX. 

HTH,
Andrus


[1] https://commons.apache.org/proper/commons-dbcp/ <https://commons.apache.org/proper/commons-dbcp/>
[2] https://commons.apache.org/proper/commons-dbcp/apidocs/org/apache/commons/dbcp2/BasicDataSource.html


> On Sep 9, 2021, at 5:36 AM, Keena Grepo <[email protected]> wrote:
> 
> Hi,
> 
> Is there any documentation that may serve as a reference on how to log the connection pool status/information for cayenne version 4.0?
> 
> Here are the only information that is being logged once the web application has started to run on the server :
> 
> 2021-09-09 09:22:58.288  INFO 25112 --- [           main] c.m.a.t.ServletInitializer               : Starting ServletInitializer v2.1.1.3 on CAVLT018 with PID 25112 (C:\sts-bundle\pivotal-tc-server\instances\base-instance\wtpwebapps\MonitoringSystem\WEB-INF\classes started by Dev.User in C:\sts-bundle\sts-3.9.9.RELEASE)
> 2021-09-09 09:22:58.294  INFO 25112 --- [           main] c.m.a.t.ServletInitializer               : The following profiles are active: default
> 2021-09-09 09:23:01.851  INFO 25112 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3351 ms
> 2021-09-09 09:23:03.651  INFO 25112 --- [           main] o.a.c.c.XMLDataChannelDescriptorLoader   : Loading XML configuration resource from file:/C:/sts-bundle/pivotal-tc-server/instances/base-instance/wtpwebapps/MonitoringSystem/WEB-INF/classes/cayenne-project.xml
> 2021-09-09 09:23:03.682  INFO 25112 --- [           main] o.a.c.c.XMLDataChannelDescriptorLoader   : Loading XML DataMap resource from file:/C:/sts-bundle/pivotal-tc-server/instances/base-instance/wtpwebapps/MonitoringSystem/WEB-INF/classes/datamap.map.xml
> 2021-09-09 09:23:04.107  INFO 25112 --- [           main] o.a.c.c.server.DataDomainProvider        : setting DataNode 'datanode' as default, used by all unlinked DataMaps
> 2021-09-09 09:23:10.374  INFO 25112 --- [           main] org.apache.cayenne.log.JdbcEventLogger   : Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
> 
> Our goal is to get the number of active connections in the pool.
> 
> Btw, the applciation is using factory="org.apache.cayenne.configuration.server.DBCPDataSourceFactory" in the cayene-project.xml file.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.