This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Performance and the fly likes Logger: use isDebugEnabled/isTraceEnabled or just log? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "Logger: use isDebugEnabled/isTraceEnabled or just log?" Watch "Logger: use isDebugEnabled/isTraceEnabled or just log?" New topic
Author

Logger: use isDebugEnabled/isTraceEnabled or just log?

olze oli
Ranch Hand

Joined: Jun 20, 2009
Posts: 148
Hi

I have some code which uses logback for logging. I read somewhere that its better to use



instead of only:


I am wondering if this is true, because it blows the code to a much bigger size, which makes it more unreadable.

I can assume that its better to use LOG.isTraceEnabled() when using stuff like String.format(), but is this true also for regular LOG.trace() calls?
Chris Hurst
Ranch Hand

Joined: Oct 26, 2003
Posts: 407
    
    1

As far as I'm aware ;-) your correct and only useful for string formatting etc which isn't involved in this case.


"Eagles may soar but weasels don't get sucked into jet engines" SCJP 1.6, SCWCD 1.4, SCJD 1.5,SCBCD 5
 
 
subject: Logger: use isDebugEnabled/isTraceEnabled or just log?
 
Similar Threads
Issue in using the DatabaseServerLoginModule for encrypting the password using MD5
WSWS3192E: Error: return code: ( 400 ) Bad Request when trying to invoked webservice
Is this overkill (logging) ?
struts-config.xml:default for action tag input attribute
Redirecting messages to a file ... append