Logfile::Rotate error,

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Logfile::Rotate error,

    Hello All,

    I'm trying to use this Log::Rotate module but i am getting an error
    messages when i try
    to run this script. I dont know enough to know where the problem may
    be.

    ############################

    use Logfile::Rotate;
    my $log = new Logfile::Rotate( File =>
    '/usr/local/apache/logs/error_log',
    Count => 7,
    Gzip => 'lib',
    Post => sub{
    open(IN,
    "/usr/local/apache/logs/httpd.pid");
    kill("HUP", chomp(<IN>)); }
    Dir => '/var/log/old',
    Flock => 'yes',
    Persist => 'yes',
    );

    # process log file

    $log->rotate();

    ############################

    ERROR MESSAGE:

    Can't modify <HANDLE> in chomp at log_rotate_script02.pl line 9, near
    "<IN>)"
    syntax error at log_rotate_script02.pl line 10, near "Dir"
    Execution of log_rotate_script02.pl aborted due to compilation errors.

    Any advice ?
    Thanks,

    onlineviewer Guest

  2. Similar Questions and Discussions

    1. FMS 2.0.4 play stream end with 404 in logfile
      Hello I installed a fms 2.0.4 on a linux box. The Admin panel and the daemon is runnig, i created a test site to connect to the fms, but i am not...
    2. new module Logfile::Access
      I just uploaded my first perl module, Logfile::Access. Makes parsing access logs very easy. ...
    3. drag model to rotate & resetWorld() error
      I have created a shockwave file that builds a toroid, and I want to allow the user to rotate the toroid once it's built, and also to build a new one...
    4. CCW Rotate and 180 rotate in PS CS are not working properly
      I have installed the singel version of Photoshop CS on a G4 under Panther and a newly purchased G5 using Panther. When a bitmap file is created (i.e....
    5. Logfile after print
      Hello Ng I have a small problem with an Aix Version 4.3 Every time I print a document to a certain printer, a second page is printed out. It...
  3. #2

    Default Re: Logfile::Rotate error,


    "onlineviewer" <lancerset@gmail.com> wrote in message
    news:1146713359.482640.51560@j73g2000cwa.googlegro ups.com...
    > Hello All,
    >
    > I'm trying to use this Log::Rotate module but i am getting an error
    > messages when i try
    > to run this script. I dont know enough to know where the problem may
    > be.
    >
    > ############################
    >
    > use Logfile::Rotate;
    > my $log = new Logfile::Rotate( File =>
    > '/usr/local/apache/logs/error_log',
    > Count => 7,
    > Gzip => 'lib',
    > Post => sub{
    > open(IN,
    > "/usr/local/apache/logs/httpd.pid");
    > kill("HUP", chomp(<IN>)); }
    > Dir => '/var/log/old',
    > Flock => 'yes',
    > Persist => 'yes',
    > );
    >
    > # process log file
    >
    > $log->rotate();
    >
    > ############################
    >
    Make that:

    Post => sub{
    open(IN,
    "/usr/local/apache/logs/httpd.pid");
    kill("HUP", chomp(<IN>)); },

    (ie add a comma at the end) and I think it will be fine. The way you've
    written it there's no separation between the hash entry for 'Post' and the
    hash entry for 'Dir'.

    Cheers,
    Rob


    Sisyphus Guest

  4. #3

    Default Re: Logfile::Rotate error,

    Hello Again,

    I tried that out and i am gettting this message still:

    Can't modify <HANDLE> in chomp at log_rotate_module02.pl line 9, near
    "<IN>)"
    Execution of log_rotate_module02.pl aborted due to compilation errors.

    onlineviewer Guest

  5. #4

    Default Re: Logfile::Rotate error,

    I've also tried this script, but no luck..

    #####################################

    use Logfile::Rotate;
    my $log = new Logfile::Rotate( File =>
    '/usr/local/apache/logs/error_log',
    Count => 7,
    Gzip => '/usr//bin/gzip',
    Signal => sub {
    my $pid = `cat
    /usr/local/apache/logs/httpd.pid`;
    my @args = ('kill', '-s',
    'HUP', $pid );
    system(@args);
    },
    Dir => '/var/log/old'
    );
    $log->rotate();

    #####################################

    Error Message:
    Signal is a deprecated argument, see Pre/Post at log_rotate_module03.pl
    line 12
    /usr/bin/kill[8]: 431^J: Arguments must be %job or process ids.

    onlineviewer Guest

  6. #5

    Default Re: Logfile::Rotate error,


    "onlineviewer" <lancerset@gmail.com> wrote in message
    news:1146754166.411693.248840@i39g2000cwa.googlegr oups.com...
    > Hello Again,
    >
    > I tried that out and i am gettting this message still:
    >
    > Can't modify <HANDLE> in chomp at log_rotate_module02.pl line 9, near
    > "<IN>)"
    > Execution of log_rotate_module02.pl aborted due to compilation errors.
    >
    Oh yes - you can't do a 'chomp(<IN>)'. (Sorry, missed that.)

    One way is to code it as:

    Post => sub{
    open(IN, "/usr/local/apache/logs/httpd.pid") or die $!; # check that open
    succeeded
    my $t = <IN>;
    chomp($t);
    kill("HUP", $t);
    },

    I don't use this module, btw, and know nothing about it - I'm just trying to
    fix the errors based on the messages being generated. I don't know whether
    that's going to make the script do whatever it is you're hoping it will do
    :-)

    Cheers,
    Rob





    Sisyphus Guest

  7. #6

    Default Re: Logfile::Rotate error,


    Sisyphus wrote:
    > Oh yes - you can't do a 'chomp(<IN>)'. (Sorry, missed that.)
    >
    > One way is to code it as:
    >
    > Post => sub{
    > open(IN, "/usr/local/apache/logs/httpd.pid") or die $!; # check that open
    > succeeded
    > my $t = <IN>;
    > chomp($t);
    > kill("HUP", $t);
    > },
    or: chomp( my $t = <IN> );

    odd though, because he copied the example straight out of the docs...

    -jp

    DJ Stunks Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139