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

This commit is contained in:
Juergen Hoeller 2010-02-09 14:57:17 +00:00
parent 3322368106
commit f0bb45ae28
4 changed files with 20 additions and 7 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -103,7 +103,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
} }
else { else {
if (logger.isDebugEnabled()) { 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); this.attributeCache.put(cacheKey, txAtt);
} }

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -94,4 +94,17 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
return (ex instanceof RuntimeException || ex instanceof Error); 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;
}
} }

View File

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

View File

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