Logging refinements for transaction and cache processing (debug/trace)

Issue: SPR-16946
This commit is contained in:
Juergen Hoeller
2018-08-10 15:45:46 +02:00
parent def6fbba89
commit aebb2d52e0
13 changed files with 41 additions and 37 deletions

View File

@@ -119,8 +119,8 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
if (txAttr instanceof DefaultTransactionAttribute) {
((DefaultTransactionAttribute) txAttr).setDescriptor(methodIdentification);
}
if (logger.isDebugEnabled()) {
logger.debug("Adding transactional method '" + methodIdentification + "' with attribute: " + txAttr);
if (logger.isTraceEnabled()) {
logger.trace("Adding transactional method '" + methodIdentification + "' with attribute: " + txAttr);
}
this.attributeCache.put(cacheKey, txAttr);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -18,6 +18,7 @@ package org.springframework.transaction.interceptor;
import org.springframework.lang.Nullable;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.util.StringUtils;
/**
* Spring's common transaction attribute implementation.
@@ -82,7 +83,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
* to process this specific transaction.
* @since 3.0
*/
public void setQualifier(String qualifier) {
public void setQualifier(@Nullable String qualifier) {
this.qualifier = qualifier;
}
@@ -141,7 +142,7 @@ public class DefaultTransactionAttribute extends DefaultTransactionDefinition im
*/
protected final StringBuilder getAttributeDescription() {
StringBuilder result = getDefinitionDescription();
if (this.qualifier != null) {
if (StringUtils.hasText(this.qualifier)) {
result.append("; '").append(this.qualifier).append("'");
}
return result;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 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.
@@ -132,7 +132,7 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
/**
* Return whether the progress of this transaction is debugged. This is used
* by AbstractPlatformTransactionManager as an optimization, to prevent repeated
* calls to logger.isDebug(). Not really intended for client code.
* calls to {@code logger.isDebug()}. Not really intended for client code.
*/
public boolean isDebug() {
return this.debug;