Log4cxx
  1. Log4cxx
  2. LOGCXX-288

Logging statement requires braces around it in an if-else

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor 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.

        Activity

        Curt Arnold made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 0.10.1 [ 12313090 ]
        Dale King created issue -

          People

          • Assignee:
            Curt Arnold
            Reporter:
            Dale King
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development