views:

910

answers:

3

i configured spring with transactional support. is there any way to show log on transaction in log?

just to ensure i set up correctly? showing in log is a good way to see what is happening

+3  A: 

Because you can access Spring classes at runtime, you can determine transaction status... this can help you: http://java.dzone.com/articles/monitoring-declarative-transac?page=0,1

Michel Kogan
+4  A: 

in your log4j.properties (for alternative loggers, or log4j's xml format, check the docs)

Depending on your transaction manager, you can set the logging level of the spring framework so that it gives you more info about transactions. For example, in case of using JpaTransactionManager, you set

log4j.logger.org.springframework.orm.jpa=INFO

(this is the package of the your transaction manager), and also

log4j.logger.org.springframework.transaction=INFO

If INFO isn't enough, use DEBUG

Bozho
`INFO` level won't show any tx activity at all, it would be too verbose. `DEBUG` will be necessary there.
skaffman
+2  A: 

Most interesting log informations of JtaTransactionManager.java (if this question is still about the JtaTransactionManager) are logged at DEBUG priority. Assuming you have a log4j.properties somewhere on the classpath, I'd thus suggest to use:

log4j.logger.org.springframework.transaction=DEBUG
Pascal Thivent