Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-2667

Defer logging message build to Logger

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • 1.7 M2
    • 1.6
    • {Unused} Core
    • None
    • Logger patch

    Description

      Instead of writing:

      LOG.debug("my debug message is " + var1 + " " + var2 + ": " + var3 ); 
      

      one should write:

      LOG.debug("my debug message is {} {}: {}", var1, var2, var3); 
      

      And only if the level is really activated, then the message String should actually be build.

      see also two discussions:
      http://n2.nabble.com/Logging-architecture-proposal-tt516791.html#none
      http://n2.nabble.com/Hibernate-3.3.1-upgrade--tt1084964.html

      It could also be argued, since at the moment String.format is used, that this form of String (eg '%s') could be used instead of '{}' .

      Attachments

        Activity

          People

            sdumitriu Sergiu Dumitriu
            yoshtec Yoshtec
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: