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

who calls Appender::close() after removing it from a Logger?

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Invalid
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: Appender
    • Labels:
      None

      Description

      Logger provides these two functions:

      /**
      Remove the appender passed as parameter form the list of appenders.
      */
      void removeAppender(const AppenderPtr& appender);

      /**
      Remove the appender with the name passed as parameter form the
      list of appenders.
      */
      void removeAppender(const LogString& name);

      It's not clear to me if the caller is responsible for calling Appender::close() on the removed appender. It's certainly possible with the first function, but with the second the caller might no longer have any reference to that appender, they might only know its name. I might be missing something that makes my concern unjustified (is Appender::close() somehow called automatically when the last reference to it is dropped?)

      The function Logger::removeAllAppenders() closes all appenders for you, so it might be reasonable for removeAppender() to close the appender it removes. Alternatively, removeAppender() could return the appender, so the user can choose to close it if they want to.

      I'm not familiar enough with the API yet to know which option is better, or even if this is a real issue.

        Attachments

          Activity

            People

            • Assignee:
              carnold@apache.org Curt Arnold
              Reporter:
              jwakely Jonathan Wakely
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: