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

Time based rolling is not working on Windows 10

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 0.10.0
    • None
    • Appender, Core
    • None
    • Windows 10, Visual studio 2019

    Description

      Hi,

      I am able to build log4cxx with following apr, apr-util and libexpat versions using Visual Studio 2019 on Windows 10 for both 32 bit and 64 bit(Disabled libiconv). apr-1.7.0, APR-util 1.6.1, log4cxx-0.10.0 and libexpat-R_2_2_10

      Tested these libraries with below code,
       
      {{log4cxx::DailyRollingFileAppenderPtr debugRollingFileAppender1(new \
      log4cxx::DailyRollingFileAppender()); //Create the date pattern in the folder structure.std::string aDatePattern = std::string("D:\\LogFolder\\Log4cxx_2019_Test
      ") + "%Y%m%d\\%H
      " + "test" + ".log";

      LOG4CXX_DECODE_CHAR(aTempLogDatePattern, aDatePattern);
      debugRollingFileAppender1->setDatePattern(aTempLogDatePattern);

      log4cxx::helpers::Pool pool; log4cxx::PatternLayoutPtr debugLayout(new log4cxx::PatternLayout());
      debugLayout->setConversionPattern(LOG4CXX_STR("%d [%t] %5p %m%n"));

      debugRollingFileAppender1->setLayout(debugLayout);
      debugRollingFileAppender1->activateOptions(pool);

      LoggerPtr logger = Logger::getLogger(_T("LogInfo"));
      logger->addAppender(debugRollingFileAppender1);
      logger->setLevel(Level::getInfo());}}

       

      While rolling over application is throwing exception "log4cxx: Exception during rollover", and after debugging found that below call in file "apr\file_io\win32\open.c" is failing to create the file. I thought it could be permission issue, but first time on application launch it is able to create file. It is failing only while rollover.

      handle = CreateFileA(fname, oflags, sharemode,
      NULL, createflags, attributes, 0); 

       

      Please let me know if you need more details.

      Thanks

      Attachments

        1. Logfile.PML
          153 kB
          Somashekhar
        2. Log4cxx_Test.log
          0.8 kB
          Somashekhar
        3. Log4cxx_error.png
          205 kB
          Somashekhar
        4. Folder_Structure.png
          38 kB
          Somashekhar

        Activity

          People

            Unassigned Unassigned
            Somashekhargg@gmail.com Somashekhar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: