HariIndianMonk has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I need some wisdom. We have a log file that continuously increases the size . After some months it is grown to 200MB which is difficult to maintain. I want some logrotator so that the if the file grows more than 10mb it will create a new file automatically, I searched this module in CPAN use Log::Dispatch::FileRotate; through PPM. But as soon I try to run the program intepreter in my window stops and the program closes. I am using 32 bit machine. If there is a good way to solve my task please let me know. Thanks and regards, Harihar Pai

Replies are listed 'Best First'.
Re: Log rotator in perl
by Happy-the-monk (Canon) on Oct 30, 2013 at 11:59 UTC

    I searched this module in CPAN use Log::Dispatch::FileRotate; through PPM. But as soon I try to run the program intepreter in my window stops and the program closes.

    Maybe you'd like to show us your code and the error message, so we get some detail to help you further.

    Or maybe you'd prefer just play around a bit more with some of these modules and then tell us, which one worked the best for you... and how and why?

    Cheers, Sören

    Créateur des bugs mobiles - let loose once, run everywhere.
    (hooked on the Perl Programming language)

Re: Log rotator in perl
by Anonymous Monk on Oct 30, 2013 at 11:44 UTC
Re: Log rotator in perl
by HariIndianMonk (Novice) on Oct 30, 2013 at 13:09 UTC

    Monks please help me.This is my code

    #!/usr/bin/perl -w use Log::Dispatch::FileRotate; # my $file = Log::Dispatch::FileRotate->new( name => 'file1', # min_level => 'info', # filename => 'ree.log', # mode => 'append', # size => 1000, # max => 5, # ); # $file->log( level => 'info', message => "Module Testing\n");

    This is the error I get

    C:\Users\hpai\Desktop\perlcoading>perl -d one.pl Loading DB routines from perl5db.pl version 1.33 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. Signal SEGV at C:/Perl/site/lib/Params/Validate/XS.pm line 42. require Params/Validate/XS.pm called at C:/Perl/lib/Module/Run +time.pm li ne 317 Module::Runtime::require_module('Params::Validate::XS') called + at C:/Per l/site/lib/Module/Implementation.pm line 85 Module::Implementation::__ANON__[C:/Perl/site/lib/Module/Imple +mentation. pm:87]() called at C:/Perl/lib/Try/Tiny.pm line 76 eval {...} called at C:/Perl/lib/Try/Tiny.pm line 67 Try::Tiny::try('CODE(0x2104394)', 'Try::Tiny::Catch=REF(0x20f4 +ac4)') cal led at C:/Perl/site/lib/Module/Implementation.pm line 90 Module::Implementation::_load_implementation('Params::Validate +', undef, 'ARRAY(0x20f4964)') called at C:/Perl/site/lib/Module/Implementation.p +m line 33 Module::Implementation::__ANON__[C:/Perl/site/lib/Module/Imple +mentation. pm:44]() called at C:/Perl/site/lib/Params/Validate.pm line 66 require Params/Validate.pm called at C:/Perl/site/lib/Log/Disp +atch.pm li ne 13 Log::Dispatch::BEGIN() called at C:/Perl/site/lib/Params/Valid +ate/XS.pm line 0 eval {...} called at C:/Perl/site/lib/Params/Validate/XS.pm li +ne 0 require Log/Dispatch.pm called at C:/Perl/site/lib/Log/Dispatc +h/Output.p m line 9 Log::Dispatch::Output::BEGIN() called at C:/Perl/site/lib/Para +ms/Validat e/XS.pm line 0 eval {...} called at C:/Perl/site/lib/Params/Validate/XS.pm li +ne 0 require Log/Dispatch/Output.pm called at C:/Perl/site/lib/Log/ +Dispatch/F ileRotate.pm line 6 Log::Dispatch::FileRotate::BEGIN() called at C:/Perl/site/lib/ +Params/Val idate/XS.pm line 0 eval {...} called at C:/Perl/site/lib/Params/Validate/XS.pm li +ne 0 require Log/Dispatch/FileRotate.pm called at one.pl line 2 main::BEGIN() called at C:/Perl/site/lib/Params/Validate/XS.pm + line 0 eval {...} called at C:/Perl/site/lib/Params/Validate/XS.pm li +ne 0
      Signal SEGV at C:/Perl/site/lib/Params/Validate/XS.pm ...

      This means that you got an access violation while trying to load/run code that uses Params::Validate. How did you install Params::Validate on the target machine? Note that PPMs compiled for one version of Perl do not work on a different version of Perl.

      A quick way to further eliminate other modules coming into play is to look at whether Params::Validate can load on its own:

      perl -MParams::Validate -e "print 'ok'"

      If that code prints ok, then you have a larger problem as you need to find the real root cause. If the above command line snippet crashes, then at least your installation of Params::Validate is broken and you need to review the installation process you used for the module.