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

Logging statement requires braces around it in an if-else

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.11.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      All

      Description

      In converting some code to Log4CXX ended up with an if-else like this:

      if(bMiniDumpSuccessful == TRUE)
      LOG4CXX_FATAL( mainLogger, "Core Dump Successful!" );
      else
      ...

      This won't compile unless you either surround the logging statement with braces or leave off the semicolon. The above code essentially produces something like this:

      if(bMiniDumpSuccessful == TRUE)
      {
      if (mainLogger->isFatalEnabled())

      { .... }

      }
      ;
      else

      And it rightly complains that the else has no if associated with it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                carnold@apache.org Curt Arnold
                Reporter:
                dalewking Dale King
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: