I configured spring with transactional support. Is there any way to log transactions just to ensure I set up everything correctly? Showing in the log is a good way to see what is happening.
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
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:
I create a thread-local variable to store the reference to the method org.springframework.transaction.support.TransactionSynchronizationManager.isActualTransactionActive(). Whenever a new log line is printed out, getSpringTransactionInfo() is called and it returns a one-character string that will go into the log.