Skip to content

Commit f0bb45a

Browse files
committed
included qualifier value in debug log for each transaction (SPR-6811)
1 parent 3322368 commit f0bb45a

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -103,7 +103,7 @@ public TransactionAttribute getTransactionAttribute(Method method, Class targetC
103103
}
104104
else {
105105
if (logger.isDebugEnabled()) {
106-
logger.debug("Adding transactional method [" + method.getName() + "] with attribute [" + txAtt + "]");
106+
logger.debug("Adding transactional method '" + method.getName() + "' with attribute: " + txAtt);
107107
}
108108
this.attributeCache.put(cacheKey, txAtt);
109109
}

org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/DefaultTransactionAttribute.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,4 +94,17 @@ public boolean rollbackOn(Throwable ex) {
9494
return (ex instanceof RuntimeException || ex instanceof Error);
9595
}
9696

97+
98+
/**
99+
* Return an identifying description for this transaction attribute.
100+
* <p>Available to subclasses, for inclusion in their <code>toString()</code> result.
101+
*/
102+
protected final StringBuilder getAttributeDescription() {
103+
StringBuilder result = getDefinitionDescription();
104+
if (this.qualifier != null) {
105+
result.append("; '").append(this.qualifier).append("'");
106+
}
107+
return result;
108+
}
109+
97110
}

org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2008 the original author or authors.
2+
* Copyright 2002-2010 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
3030
* both positive and negative. If no rules are relevant to the exception, it
3131
* behaves like DefaultTransactionAttribute (rolling back on runtime exceptions).
3232
*
33-
* <p>TransactionAttributeEditor creates objects of this class.
33+
* <p>{@link TransactionAttributeEditor} creates objects of this class.
3434
*
3535
* @author Rod Johnson
3636
* @author Juergen Hoeller
@@ -159,7 +159,7 @@ public boolean rollbackOn(Throwable ex) {
159159

160160
@Override
161161
public String toString() {
162-
StringBuilder result = getDefinitionDescription();
162+
StringBuilder result = getAttributeDescription();
163163
if (this.rollbackRules != null) {
164164
for (RollbackRuleAttribute rule : this.rollbackRules) {
165165
String sign = (rule instanceof NoRollbackRuleAttribute ? PREFIX_COMMIT_RULE : PREFIX_ROLLBACK_RULE);

org.springframework.transaction/src/test/resources/log4j.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<level value="warn" />
1616
</logger>
1717

18-
<logger name="org.springframework.binding">
18+
<logger name="org.springframework.transaction">
1919
<level value="debug" />
2020
</logger>
2121

0 commit comments

Comments
 (0)