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

DailyRollingFileAppender not using Property options

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.10.0
    • 0.10.0
    • Appender, Configurator
    • 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()

      Attachments

        Activity

          People

            carnold@apache.org Curt Arnold
            ito Tsuyoshi Ito
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: