Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better method identification in AnnotationTransactionAttributeSource logging [SPR-11267] #15892

Closed
spring-projects-issues opened this issue Dec 30, 2013 · 2 comments

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Dec 30, 2013

Thomas Whitmore opened SPR-11267 and commented

We am using @Transactional annotations in our projects, but logging does not identify the methods found very well.

In our project there are many separate DAOs & services, which frequently use similar method-names. We see 400+ of these, a good proportion of which have repetitive names & without classes cannot be identified:

Adding transactional method 'findById' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
Adding transactional method 'remove' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
Adding transactional method 'create' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
Adding transactional method 'update' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
Adding transactional method 'findById' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
Adding transactional method 'create' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
Adding transactional method 'update' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''

We want to be able to identify whether a particular class/method is getting scanned (or not) for transactionality, to allow us to engineer/ diagnose/ debug in this area.

Logging Class.Method would be much more useful (simple name only, no FQN) to enable engineering & diagnostis of transaction definitions.

(Keywords: AbstractFallbackTransactionAttributeSource, AnnotationTransactionAttributeSource, transaction attribute source logging, method name.)


Affects: 3.2.6

Issue Links:

  • #17141 Performance - hashCode method of AbstractFallbackTransactionAttributeSource.DefaultCacheKey doesn't take targetClass into account

Referenced from: commits 57eedf3, 82ea9ec

Backported to: 3.2.7

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 30, 2013

Thomas Whitmore commented

I propose a simple two-line fix to AbstractFallbackTransactionAttributeSource.getTransactionAttribute():

// TW 30/12/13 -- log Class.Method name, to clearly identify which method.
//
String methodName = targetClass.getSimpleName()+"."+method.getName();
logger.debug("Adding transactional method '" + methodName + "' with attribute: " + txAtt);

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 1, 2014

Juergen Hoeller commented

Good point. We're logging the target class if available now, otherwise the method's declaring class.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants