Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Logger: use isDebugEnabled/isTraceEnabled or just log?

 
olze oli
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I'm aware ;-) your correct and only useful for string formatting etc which isn't involved in this case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic