Our Hibernate and Spring configuration is:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" lazy-init="true">
<property name="entityInterceptor" ref="entityInterceptor"/>
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:META-INF/hibernate.cfg.xml"/>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
<!-- Start For HProf:
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="generate_statistics">true</prop>
</props>
</property>
<hprof:profiler host="192.168.121.81" port="22897" />
End For HProf -->
</bean>
Also hibernate.cfg.xml:
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
<property name="hibernate.bytecode.use_reflection_optimizer">true</property>
<property name="hibernate.generate_statistics">true</property>
.... Finally i could get information about Statements and Session and analysis by changing our policy for logging. I remove every thing about logback and replace it with log4j. i think java can not work with both of them in the same project. i used "slf4j-log4j12-1.6.6.jar" for mapping slf4j to log4j for third parties like hibernate. after of all above, i could profile our project for a while but after some doing some action in application all of available connection and hibernate session become finish and every thing will be corrupted. I think some thing in the middle do not allow releasing or closing the sessions.
Another question is if i want to profile our project by Configuring the application to be profile without changing the application code by setting a log4j.xml file and using appender like :
(http://hibernateprofiler.com/learn/usage/manual-config)
<appender name="Hibernate.Profiler"
class="hibernatingrhinos.hibernate.profiler.appender.HibernateProfilerAppender">
<layout class="org.apache.log4j.xml.XMLLayout" />
</appender>
how could i say to it to sink or send log data to our HProf client? something like :
<sink value="tcp://127.0.0.1:22897" />
and Remove <hprof:profiler host="192.168.121.81" port="22897" /> from spring configuration and sessionFactory
analysis of your profiler tool is great. we are really interested in having this tool.
Regards,