Menu

FileRotate not working for me

Help
Steve
2006-03-23
2013-06-04
  • Steve

    Steve - 2006-03-23

    I am using Log::Dispatch::FileRotate 1.11 and Log4perl 0.50.  A log file is produced and messages are being logged.  However, the file is not being rotated.  Here is what is in the config file for the rotating appender:

    log4perl.appender.Roll1=Log::Dispatch::FileRotate
    log4perl.appender.Roll1.filename=test.log
    log4perl.appender.Roll1.max=3
    log4perl.appender.Roll1.name=test
    log4perl.appender.Roll1.DatePattern=yyyy-MM-DD
    log4perl.appender.Roll1.mode=append
    log4perl.appender.Roll1.TZ=GMT
    log4perl.appender.Roll1.layout=Log::Log4perl::Layout::PatternLayout
    log4perl.appender.Roll1.layout.ConversionPattern=%d {ISO8601} %p [%C] %m%n

    Can anyone help?  TIA!

     
    • Mike Schilli

      Mike Schilli - 2006-03-24

      You're using yyyy-MM-DD as a date pattern, but the Log::Dispatch::FileRotate man page says:

        ...
        yyyy-MM-dd           every day
        ...

       
    • Steve

      Steve - 2006-03-24

      Sorry, that was a typo in my post.  I have yyyy-MM-dd in my configuration file.  In fact, I changed it to yyyy-MM-dd-HH-MM and it still doesn't work.

      I also have the following in my config file:
      log4perl.category= DEBUG, Roll1

       
    • Mike Schilli

      Mike Schilli - 2006-03-24

      Try this:

      use Log::Log4perl qw(:easy);

      Log::Log4perl->init( \ q{
      log4perl.category         = DEBUG, Logfile
      log4perl.appender.Logfile = Log::Dispatch::FileRotate
      log4perl.appender.Logfile.filename    = test.log
      log4perl.appender.Logfile.mode        = append
      log4perl.appender.Logfile.max         = 5
      log4perl.appender.Logfile.DatePattern = yyyy-MM-dd-HH-mm
      log4perl.appender.Logfile.TZ          = PST
      log4perl.appender.Logfile.layout = \      Log::Log4perl::Layout::PatternLayout
      log4perl.appender.Logfile.layout.ConversionPattern = %d %m %n
      });

      DEBUG "foo";

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.