1 Reply Latest reply on Aug 12, 2009 10:13 PM by 843829

    Optimizing out logging statements that have no effect

      Hi, it seems a common problem is that when doing logging such as:
      logger.debug("got message: " + message);
      we pay for the cost of constructing a new String, which is an operation with no side effects - unless we first check that the logging level is at least DEBUG, which is tedious, more verbose, and easily omitted. Does Hotspot have any optimization tricks for avoiding this cost in logging statements like the one above? Thanks in advance for any answers.