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

Unnecessary returnValue.toString() invocation in ResultSetSpy.reportAllReturns() #13

Open
GoogleCodeExporter opened this issue Apr 5, 2016 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Configure log4jdbc-log4j with OFF loggers
2. Execute high load with select queries on DataSourceSpy
3. look at profiler 

What is the expected output? What do you see instead?
I expect NO CPU utilization by ResultSetSpy. But I see a lot of CPU grabbed by 
ResultSetSpy

What version of the product are you using? On what operating system?
1.16

Please provide any additional information below.
It is due to redundant returnValue.toString() in 
ResultSetSpy.reportAllReturns() method(ResultSetSpy.java:111). It needs to be 
wrapped by condition and to be executed only if necessary.

Original issue reported on code.google.com by Roman.Si...@gmail.com on 31 Jan 2014 at 9:44

@GoogleCodeExporter
Copy link
Author

Actually it would be better to make Slf4jSpyLogDelegator.methodReturned() 
accept "Object returnMsg" and convert it into the String inside of 
"if(logger.isInfoEnabled())" instead of accepting "String returnMsg".

Original comment by Roman.Si...@gmail.com on 31 Jan 2014 at 9:51

@GoogleCodeExporter
Copy link
Author

Hmm, I agree with your suggestions, but it would impact existing code a lot: I 
would need to go through all the "historical" log4jdbc code, using the 
`reportReturn` methods; also I would need to modify the signature of the 
SpyLogDelegator interface, which will break existing applications with custom 
SpyLogDelegators.

But I agree that this is a required modification, I just need to think about it 
a bit more.

In the meantime, are you sure that all your loggers are off? Because in that 
case, DataSourceSpy is supposed to return the real JDBC connection, not wrapped 
into a ConnectionSpy (see the condition `if 
(spyLogDelegator.isJdbcLoggingEnabled())` in the `getConnection` methods. You 
shouldn't see any use of ResultSetSpy. 

Original comment by frederic...@gmail.com on 11 Feb 2014 at 4:59

  • Changed state: Accepted
  • Added labels: Performance
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

Probably one logger is set up with ERROR level

Original comment by Roman.Si...@gmail.com on 1 Apr 2014 at 5:11

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

No branches or pull requests

1 participant