'How to log current transaction in exception

Hello this is follow up question of Spring @Transactional Timeout not working as expected

But exception is not restricted to it. We are also using spring with JDBC Transaction manager.

@Transactional(value = "transactionManagerDC")
public void doOperation() {
    try {
        customRuleService.save();

    } catch (RuntimeException e)
    String transactionName = "abc"; // <-- How can I get current transaction which failed. Because customRuleService.save() also calling two methods having transaction 
    logger("transaction was time out:" + transactionName);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source