Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-193

Please rename or remove new local variable "buf" in Logger.h macros

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.10.0
    • 0.10.0
    • Appender
    • None
    • All environments.

    Description

      The new logging macros have a dangerous new feature, ie the local variable buf

      #define LOG4CXX_LOG(logger, level, message) { \
      if (logger->isEnabledFor(level)) {\
      ::log4cxx::helpers::MessageBuffer buf; \ <--------------- ****** broke my build!!!
      logger->forcedLog(level, buf.str(buf << message), LOG4CXX_LOCATION); } }

      I upgraded from 0.97 HEAD to 0.10.0 HEAD and my build broke, since my source code also uses many local variables called "buf" which get logged.

      Please consider either eliminating the named local variable altogether, or giving it an implementation-level name, eg _buf_.

      Many thanks!

      Attachments

        Activity

          People

            carnold@apache.org Curt Arnold
            aerskine Allan Erskine
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: