Log4cxx
  1. Log4cxx
  2. LOGCXX-136

DailyRollingFileAppender not using Property options

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: Appender, Configurator
    • Labels:
      None

      Description

      Using SVN head from 25/4/2006, I noticed that some projects using DailyRollingFileAppender in the .properties file were not logging anymore (it did with v0.9.7).
      Enabling debug for log4cxx shows a message "File option not set for appender ..."

      Browsing through the sources, I noticed DailyRollingFileAppender is marked deprecated and can be replaced with the new rolling.RollingFileAppender, but should be working for compatibility with existing code.
      However, when using it via PropertyConfigurator, the options are never set.

      Stepping through PropertyConfigurator::parseAppender() I noticed setting the options was skipped because this always returned FALSE:
      if (appender->instanceof(OptionHandler::getStaticClass()))

      So I managed to get it working by adding a CAST_ENTRY for OptionHandler in dailyrollingfileappender.h:
      (not at all sure that is the correct way to fix it however)

      class DailyRollingFileAppender : public log4cxx::helpers::ObjectImpl, Appender {
      DECLARE_LOG4CXX_OBJECT(DailyRollingFileAppender)
      BEGIN_LOG4CXX_CAST_MAP()
      LOG4CXX_CAST_ENTRY(DailyRollingFileAppender)
      LOG4CXX_CAST_ENTRY(Appender)
      + LOG4CXX_CAST_ENTRY(spi::OptionHandler)
      END_LOG4CXX_CAST_MAP()

        Activity

        Hide
        Curt Arnold added a comment -

        Fix committed rev 486308.

        The missing entry for spi::OptionHandler in the class description also affected log4cxx::RollingFileAppender. The patch files the missing entry in both locations. In addition, it enables to DailyRollingFileAppenderTest which had been disabled since File::list() had not been implemented and added an explicit test that log4cxx::RollingFileAppender().instanceof(log4cxx::spi::OptionHandler) returns true.

        Show
        Curt Arnold added a comment - Fix committed rev 486308. The missing entry for spi::OptionHandler in the class description also affected log4cxx::RollingFileAppender. The patch files the missing entry in both locations. In addition, it enables to DailyRollingFileAppenderTest which had been disabled since File::list() had not been implemented and added an explicit test that log4cxx::RollingFileAppender().instanceof(log4cxx::spi::OptionHandler) returns true.

          People

          • Assignee:
            Curt Arnold
            Reporter:
            Iwan Tomlow
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development