You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Keena Grepo <ke...@gmail.com> on 2021/09/09 02:36:52 UTC

Cayenne Version 4.0 Logging

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.

Re: Cayenne Version 4.0 Logging

Posted by Michael Gentry <bl...@gmail.com>.
Hi Keena,

At some point you may want to consider switching to HikariCP [1]. I don't
remember the exact numbers, but a couple years ago I switched a Cayenne
application from DBCP to HikariCP and the speed increase was noticeable.
The more faults (lazy loads) your application does fetching in
relationships, the more noticeable it'll be. Of course, if your application
is low-volume or doesn't have a lot of relationships, it might not be worth
the effort. HikariCP would be my first choice today for any non-trivial
application. Also, frameworks like Spring Boot default to using HikariCP
now, too, so it has become more popular.

mrg

[1] https://github.com/brettwooldridge/HikariCP


On Wed, Sep 8, 2021 at 10:36 PM Keena Grepo <ke...@gmail.com>
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.
>

Re: Cayenne Version 4.0 Logging

Posted by Andrus Adamchik <aa...@gmail.com>.
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 <ke...@gmail.com> 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.