Showing a Spring transaction in log

前端 未结 7 492
名媛妹妹
名媛妹妹 2020-11-30 19:10

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 wh

7条回答
  •  孤独总比滥情好
    2020-11-30 19:30

    For me, a good logging config to add was:

    log4j.logger.org.springframework.transaction.interceptor = trace

    It will show me log like that:

    2012-08-22 18:50:00,031 TRACE - Getting transaction for [com.MyClass.myMethod]

    [my own log statements from method com.MyClass.myMethod]

    2012-08-22 18:50:00,142 TRACE - Completing transaction for [com.MyClass.myMethod]

提交回复
热议问题