[QFJ-138] Surround calls to log() function with an if statement to avoid costly string concats if the logger is not enabled Created: 10/Feb/07 Updated: 12/Apr/07 Resolved: 11/Feb/07 |
|
Status: | Closed |
Project: | QuickFIX/J |
Component/s: | Examples |
Affects Version/s: | 1.0.5 |
Fix Version/s: | 1.1.0 |
Type: | Improvement | Priority: | Minor |
Reporter: | Toli Kuznets | Assignee: | Steve Bate |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Description |
This is an obviously low-priority RFE Would be a nice idea to surround all calls to the logging code with this is probably only applicable to all the incoming/outgoing FIX message logging, may not be that expensive but probably a good idea. |
Comments |
Comment by Steve Bate [ 11/Feb/07 ] |
I'm going to guard the private log() method in the SLF4JLog. Is that what you intended? |
Comment by Toli Kuznets [ 11/Feb/07 ] |
I think the problem may actually be higher up the chain of call. by the time it makes it to the SLF4J.log() method the strings have already been concatted. I'm thinking of something like the Session class, where at line 246 we have this: by the time that gets down to the particular logger, the String concat has already happened. so ideally it'd be something like this: if(getLog().onEventEnabled()) { May be too hard to do for combined loggers and such. I was mostly concerned with all the incoming/outgoing FIX messages, but i now realize that these are not constructed form concatenating strings (in Session.send or Log.onOutgoing) - these have already been created, so we are not paying double to create another string to print it. so this may be a non-issue. |