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

        Curt Arnold made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Fix Version/s 0.10.0 [ 10782 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Iwan Tomlow created issue -

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development