Browse Source

included qualifier value in debug log for each transaction (SPR-6811)

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@2937 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 16 years ago
parent
commit
c6f1d755b5
  1. 4
      org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/AbstractFallbackTransactionAttributeSource.java
  2. 15
      org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/DefaultTransactionAttribute.java
  3. 6
      org.springframework.transaction/src/main/java/org/springframework/transaction/interceptor/RuleBasedTransactionAttribute.java
  4. 2
      org.springframework.transaction/src/test/resources/log4j.xml

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -103,7 +103,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran @@ -103,7 +103,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
}
else {
if (logger.isDebugEnabled()) {
logger.debug("Adding transactional method [" + method.getName() + "] with attribute [" + txAtt + "]");
logger.debug("Adding transactional method '" + method.getName() + "' with attribute: " + txAtt);
}
this.attributeCache.put(cacheKey, txAtt);
}

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -94,4 +94,17 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im @@ -94,4 +94,17 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
return (ex instanceof RuntimeException || ex instanceof Error);
}
/**
* Return an identifying description for this transaction attribute.
* <p>Available to subclasses, for inclusion in their <code>toString()</code> result.
*/
protected final StringBuilder getAttributeDescription() {
StringBuilder result = getDefinitionDescription();
if (this.qualifier != null) {
result.append("; '").append(this.qualifier).append("'");
}
return result;
}
}

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

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory; @@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory;
* both positive and negative. If no rules are relevant to the exception, it
* behaves like DefaultTransactionAttribute (rolling back on runtime exceptions).
*
* <p>TransactionAttributeEditor creates objects of this class.
* <p>{@link TransactionAttributeEditor} creates objects of this class.
*
* @author Rod Johnson
* @author Juergen Hoeller
@ -159,7 +159,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i @@ -159,7 +159,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
@Override
public String toString() {
StringBuilder result = getDefinitionDescription();
StringBuilder result = getAttributeDescription();
if (this.rollbackRules != null) {
for (RollbackRuleAttribute rule : this.rollbackRules) {
String sign = (rule instanceof NoRollbackRuleAttribute ? PREFIX_COMMIT_RULE : PREFIX_ROLLBACK_RULE);

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

@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
<level value="warn" />
</logger>
<logger name="org.springframework.binding">
<logger name="org.springframework.transaction">
<level value="debug" />
</logger>

Loading…
Cancel
Save