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

Logging statement requires braces around it in an if-else

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.10.0
    • 0.11.0
    • None
    • None
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment