Re: Logger messages getting stuck in a buffer somewhere?

From: Karen Wieprecht (karen.wieprecht_at_jhuapl.edu)
Date: 01/25/05

  • Next message: Mike Delaney: "Re: Logger messages getting stuck in a buffer somewhere?"
    Date: Tue, 25 Jan 2005 09:31:52 -0500
    
    

    >
    > If you're having problems with both techniques, maybe there's a problem
    > with your system's syslogd or syslog() function, since everything is
    > dependent on these.
    >

    I don't think it's a problem with syslogd directly, I've been able to log
    one liners with no problem. they show up right away. Also, I've been
    working with tech support at SGI, and they haven't seen any problems with
    direct C library calls to syslog which is used by logger. I'm beginning
    to suspect that perl isn't built properly? I tested the return values of
    the syslog calls I did inside my program, and I get varying positive
    integers (I think this is the number of characters in the string it thinks
    it is sending to the syslog routine). Take a peak at the following and
    let me know if you have any other ideas.

    Here is a code snippit of what I was testing with perl 5.6.1 (and yes,
    syslog.conf is configured correctly, logger -p local5.notice "test message"
    comes into the system log just fine):
    ------------------------------------------------------------

     use Sys::Syslog qw(:DEFAULT setlogsock);
     setlogsock ("unix");
     openlog ("audit", "ndelay,nowait", "local5");

    while ( <> ) {
         chomp;
         $PRINT_STRING = $_;
          syslog ("notice", " %s\n",$PRINT_STRING) ;
    }
    closelog ();

    I never get a syntax error, but I don't get any of the messages into the
    system log either . I can't get the syslog command to DO anything. the
    syntax looks right compared to many samples of the code I've seen ... maybe
    I'm missing something?

    I got this from SGI tech support:
    ---------------------------------
    I have attached a simple "c" program that I use to test out syslog messages
    with. If you look at the code, I delay/sleep 5 seconds after logging a bunch
    of lines, then close the logfile, do it again with different messages and so
    forth. I do not see the log delays when I use this program....... I would
    have thought that if I did not close the log file right away, that the
    messages may get delayed but they do not...... The logger binary you use
    does the same thing becuase I looked at it's source code so I am not sure
    why it seems to exhibit delays where my program does not..... see for
    yourself.....

    chris

    #include <syslog.h>

    main()
    {
      openlog("cjd", LOG_PID, LOG_DAEMON);
            syslog(LOG_ALERT, "ALERT test from cjd");
            syslog(LOG_CRIT, "CRIT test from cjd");
            syslog(LOG_ERR, "ERR test from cjd");
            syslog(LOG_WARNING, "WARNING test from cjd");
             syslog(LOG_NOTICE, "NOTICE test from cjd");
             syslog(LOG_INFO, "INFO test from cjd");
             syslog(LOG_DEBUG, "DEBUG test from cjd");
             syslog(LOG_EMERG, "EMERG test from cjd");

      sleep(5);

     closelog();
     openlog("cjd", LOG_PID, LOG_USER);
            syslog(LOG_ALERT, "ALERT test from cjd");
            syslog(LOG_CRIT, "CRIT test from cjd");
            syslog(LOG_ERR, "ERR test from cjd");
            syslog(LOG_WARNING, "WARNING test from cjd");
            syslog(LOG_NOTICE, "NOTICE test from cjd");
            syslog(LOG_INFO, "INFO test from cjd");
            syslog(LOG_DEBUG, "DEBUG test from cjd");
            syslog(LOG_EMERG, "EMERG test from cjd");

     sleep(5);

     closelog();

     openlog("cjd", LOG_PID, LOG_LOCAL2);
            syslog(LOG_ALERT, "ALERT test from cjd");
            syslog(LOG_CRIT, "CRIT test from cjd");
            syslog(LOG_ERR, "ERR test from cjd");
            syslog(LOG_WARNING, "WARNING test from cjd");
            syslog(LOG_NOTICE, "NOTICE test from cjd");
            syslog(LOG_INFO, "INFO test from cjd");
            syslog(LOG_DEBUG, "DEBUG test from cjd");
            syslog(LOG_EMERG, "EMERG test from cjd");

     sleep(5);

     closelog();


  • Next message: Mike Delaney: "Re: Logger messages getting stuck in a buffer somewhere?"

    Relevant Pages