Two Laptop Bag*
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
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: 416
    
    2

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logger: use isDebugEnabled/isTraceEnabled or just log?