Professional Web Applications Themes

Sys:Syslog - PERL Beginners

Hi - I'm having trouble logging to syslog on my Linux (Sorcerer) machine with perl 8.0.2 installed. This script logs nothing: #!/usr/bin/perl use strict; use warnings; use Sys::Syslog qw(:DEFAULT setlogsock); setlogsock('unix'); openlog($0, 'cons,pid', 'user'); syslog('err', 'test error msg'); closelog(); Removing the 'setlogsock' doesn't help; still a noop. Writing the same thing in C using syslog(3) calls, everthing works. ??? Aloha => Beau;...

  1. #1

    Default Sys:Syslog

    Hi -

    I'm having trouble logging to syslog on my Linux (Sorcerer)
    machine with perl 8.0.2 installed. This script logs nothing:

    #!/usr/bin/perl

    use strict;
    use warnings;
    use Sys::Syslog qw(:DEFAULT setlogsock);

    setlogsock('unix');
    openlog($0, 'cons,pid', 'user');
    syslog('err', 'test error msg');
    closelog();

    Removing the 'setlogsock' doesn't help; still a noop.

    Writing the same thing in C using syslog(3) calls, everthing
    works.

    ???

    Aloha => Beau;

    Beau E. Cox Guest

  2. #2

    Default Re: Sys:Syslog

    Beau E. Cox wrote:
    > Hi -
    >
    > I'm having trouble logging to syslog on my Linux (Sorcerer)
    > machine with perl 8.0.2 installed. This script logs nothing:
    >
    Should that be 5.8.2?
    > #!/usr/bin/perl
    >
    > use strict;
    > use warnings;
    > use Sys::Syslog qw(:DEFAULT setlogsock);
    >
    > setlogsock('unix');
    > openlog($0, 'cons,pid', 'user');
    > syslog('err', 'test error msg');
    > closelog();
    >
    > Removing the 'setlogsock' doesn't help; still a noop.
    >
    > Writing the same thing in C using syslog(3) calls, everthing
    > works.
    >
    > ???
    >
    The above works (copied exactly) on my RH 9 box using 5.8.0 default. I
    am assuming syslogd is running?

    You might try catching the error condition of the openlog I *guess* it
    is the same as a standard open, though the docs do a very poor job of
    discussing the error handling for the module.

    [url]http://danconia.org[/url]

    Wiggins D'Anconia Guest

  3. #3

    Default Re: Sys:Syslog

    Beau E. Cox wrote:
    > Hi -
    >
    > I'm having trouble logging to syslog on my Linux (Sorcerer)
    > machine with perl 8.0.2 installed. This script logs nothing:
    >
    > #!/usr/bin/perl
    >
    > use strict;
    > use warnings;
    > use Sys::Syslog qw(:DEFAULT setlogsock);
    >
    > setlogsock('unix');
    > openlog($0, 'cons,pid', 'user');
    > syslog('err', 'test error msg');
    > closelog();
    >
    > Removing the 'setlogsock' doesn't help; still a noop.
    >
    > Writing the same thing in C using syslog(3) calls, everthing
    > works.
    what machine are you running this with? how do you verify that nothing is
    printed? i have no problem doing the following:

    #!/usr/bin/perl -w
    use strict;

    use Sys::Syslog;

    openlog($0 => pid => 'user');

    syslog('err','test error message');

    closelog();

    __END__

    david
    --
    s,.*,<<,e,y,\n,,d,y,.s,10,,s
    ..ss.s.s...s.s....ss.....s.ss
    s.sssss.sssss...s...s..s....
    ....s.ss..s.sss..ss.s....ss.s
    s.sssss.s.ssss..ss.s....ss.s
    ...s..sss.sssss.ss.sss..ssss.
    ...sss....s.s....ss.s....ss.s

    ,....{4},"|?{*=}_'y!'+0!$&;"
    ,ge,y,!#:$_(-*[./<-{-},b-t,
    ..y...,$~=q~=?,;^_#+?{~,,$~=~
    y.!-&*-/:-^_{}.a-t ().;s,;,
    );,g,s,s,$~s,g,y,y,%,,g,eval
    David Guest

  4. #4

    Default Re: Sys:Syslog

    On Monday 24 November 2003 03:03 pm, david wrote:
    > Beau E. Cox wrote:
    > > Hi -
    > >
    > > I'm having trouble logging to syslog on my Linux (Sorcerer)
    > > machine with perl 8.0.2 installed. This script logs nothing:
    Oops - perl 5.8.2
    > > [snipped]
    "beefed" up the script to:

    #!/usr/bin/perl

    use strict;
    use warnings;
    use Sys::Syslog qw(:DEFAULT setlogsock);

    eval { setlogsock('unix'); };
    print "eval setlogsock: $\n" if $;
    eval { openlog($0, 'cons,pid', 'user'); };
    print "eval openlog: $\n" if $;
    eval { syslog('err', 'test error msg'); };
    print "eval syslog: $\n" if $;
    eval { closelog(); };
    print "eval closelog: $\n" if $;

    setlogsock('unix') || die "err setlogsock: $!\n";
    openlog($0, 'cons,pid', 'user') || die "err logopen: $!\n";
    syslog('err', 'test error msg') || die "err syslog: $!\n";
    closelog() || die "err closelog: $!\n";

    The only output printed is:

    err closelog:

    which has an empty $! so prob. not an error.
    Nothing goes to the log.
    > what machine are you running this with? how do you verify that nothing is
    > printed? i have no problem doing the following:
    >
    Running on the local machine; I look in the /var/log/everything/current file
    which is where 'everything' is logged - I'm using metalog 0.7. This is where
    my test C program sucessfully logs.

    Maybe it has something to do with metalog - but everything else is
    logging fine...

    I'm stumped.

    Aloha => Beau;


    Beau E. Cox Guest

  5. #5

    Default Re: Sys:Syslog


    On Monday, Nov 24, 2003, at 15:32 US/Pacific, Beau E. Cox wrote:
    [..]
    > I'm having trouble logging to syslog on my Linux (Sorcerer)
    > machine with perl 8.0.2 installed. This script logs nothing:
    >
    > #!/usr/bin/perl
    >
    > use strict;
    > use warnings;
    > use Sys::Syslog qw(:DEFAULT setlogsock);
    >
    > setlogsock('unix');
    > openlog($0, 'cons,pid', 'user');
    > syslog('err', 'test error msg');
    > closelog();
    [..]

    I know that you found a way around this with
    the Unix::Syslog code. But thought I would mention
    that this works fine on SuSe, running their v5.8.1
    just as is:

    Nov 25 08:41:21 meatbop sys_log.plx[31368]: test error msg

    So there could be some 'issue' either with that version
    of perl on that version of the OS...



    ciao
    drieux

    ---

    Drieux Guest

  6. #6

    Default Re: Sys:Syslog

    On Tuesday 25 November 2003 06:48 am, drieux wrote:
    > On Monday, Nov 24, 2003, at 15:32 US/Pacific, Beau E. Cox wrote:
    > [..]
    >
    > > I'm having trouble logging to syslog on my Linux (Sorcerer)
    > > machine with perl 8.0.2 installed. This script logs nothing:
    > >
    > > #!/usr/bin/perl
    > >
    > > use strict;
    > > use warnings;
    > > use Sys::Syslog qw(:DEFAULT setlogsock);
    > >
    > > setlogsock('unix');
    > > openlog($0, 'cons,pid', 'user');
    > > syslog('err', 'test error msg');
    > > closelog();
    >
    > [..]
    >
    > I know that you found a way around this with
    > the Unix::Syslog code. But thought I would mention
    > that this works fine on SuSe, running their v5.8.1
    > just as is:
    >
    > Nov 25 08:41:21 meatbop sys_log.plx[31368]: test error msg
    >
    > So there could be some 'issue' either with that version
    > of perl on that version of the OS...
    >
    Hi drieux -

    Long time no hear; I hope you are doing well.

    I think it may have something to do with metalog 0.7 (???). That
    seems to be the big difference here (although I must admit other
    processes have no trouble logging).

    I agree, there is an unresolved issue here - metalog, perl 5.8.2,
    Sorcerer, etc., but I'm going to duck it for now so I can get this
    project out the door (read $MONEY$). I'll keep a lookout for
    other logging bug-a-boos in the meantime, and, hopefully get
    back to a better ysis later. Larry and Tom, you guys wrote
    Sys::Syslog many years ago, any ideas?

    Aloha => Beau;

    Beau E. Cox Guest

Similar Threads

  1. Sys::Syslog
    By Fletcher Mattox in forum PERL Modules
    Replies: 0
    Last Post: March 13th, 09:12 PM
  2. Syslog question
    By Rob in forum Linux / Unix Administration
    Replies: 0
    Last Post: October 27th, 09:22 PM
  3. AIX 5.1.0.0 syslog mistery
    By prae in forum AIX
    Replies: 1
    Last Post: September 17th, 07:36 AM
  4. syslog truncate
    By Sinisa in forum SCO
    Replies: 3
    Last Post: August 1st, 01:24 PM
  5. Replies: 3
    Last Post: July 23rd, 03:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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