cancel
Showing results for 
Search instead for 
Did you mean: 

sql query debug

darminm
Champ on-the-rise
Champ on-the-rise
Does Alfresco allow for debugging all queries?

I tried adding the following to Alfresco log4j.properties:

log4j.logger.com.ibatis=DEBUG
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
log4j.logger.java.sql=DEBUG
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG
log4j.logger.java.sql.ResultSet=DEBUG


# Hibernate logging options (INFO only shows startup messages)
log4j.logger.org.hibernate=INFO
# Log JDBC bind parameter runtime arguments
log4j.logger.org.hibernate.type=trace
log4j.logger.org.hibernate.SQL=debug


It does print the startup queries but that is it.  
5 REPLIES 5

afaust
Legendary Innovator
Legendary Innovator
Full JDBC logging is only possible by using a special JDBC driver wrapper that enables you to capture every statement. This could be achieved by using <a href="https://p6spy.github.io/p6spy/2.0/install.html">P6Spy</a> which I regularly use for any low-level logging needs.

darminm
Champ on-the-rise
Champ on-the-rise
I am trying to do that per https://wiki.alfresco.com/wiki/Driver-side_DB_Query_Profiling

however I get no log.

I am using:

Alfresco 5.0.2 enterprise
p6spy.jar (v2.2.0)
sqljdbc42.jar

### spy.properties in tomcat/shared/classes:

module.log=com.p6spy.engine.logging.P6LogFactory
realdriver=com.microsoft.sqlserver.jdbc.SQLServerDriver
autoflush=true
excludecategories=
appender=com.p6spy.engine.logging.appender.FileLogger
logfile=D:\Alfresco\tomcat\logs\logsspy.log
deregisterdrivers=true



### alfresco-global.properties
#db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.driver=com.p6spy.engine.spy.P6SpyDriver


Alfresco starts up fine…

afaust
Legendary Innovator
Legendary Innovator
The wiki page is outdated. Please refer to the actual P6Spy documentation that corresponds to your version of P6Spy. The contents for the configuration file have changed a lot since the wiki page was written.

douglascrp
World-Class Innovator
World-Class Innovator

The following is the most up to date blog post on the topic that I know about:

https://www.ziaconsulting.com/developer-help/setting-p6spy-alfresco/ 

vincent-kali
Star Contributor
Star Contributor

I needed to modify both db.driver and db.url to get P6 log:


### database connection properties ###
#db.driver=org.postgresql.Driver
db.driver=com.p6spy.engine.spy.P6SpyDriver
db.username=alfresco
db.password=*****

db.name=alfresco
#db.url=jdbcSmiley Tongueostgresql://localhost:5432/${db.name}
db.url=jdbcSmiley Tongue6spySmiley Tongueostgresql://localhost:5432/${db.name}