Showing a Spring transaction in log

前端 未结 7 483
名媛妹妹
名媛妹妹 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:49

    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

提交回复
热议问题