*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> syslog (3)              
Title
Content
Arch
Section
 

syslog(3)

Contents


NAME    [Toc]    [Back]

       closelog,  openlog,  setlogmask, syslog, closelog_r, openlog_r,
 setlogmask_r, syslog_r - Control system log

SYNOPSIS    [Toc]    [Back]

       #include <syslog.h>

       void closelog(
               void ); void openlog(
               const char *id,
               int log_option,
               int facility ); int setlogmask(
               int mask_priority ); void syslog(
               int priority,
               const char *format, ...  ); void closelog_r(
               struct syslog_data *syslog_data ); int openlog_r(
               const char *id,
               int log_option,
               int facility,
               struct syslog_data  *syslog_data  );  int  setlogmask_r(

               int mask_priority,
               struct syslog_data *syslog_data ); int syslog_r(
               int priority,
               struct syslog_data *syslog_data,
               const char *format, ...  );

       The following function declarations do not conform to current
 standards and are supported only for backward compatibility.


       int openlog(
               const char *id,
               int log_option,
               int facility ); int syslog(
               int priority,
               const char *format, ...  );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces  documented  on  this reference page conform to
       industry standards as follows:

       closelog(), openlog(), setlogmask(), syslog():  XSH4.2

       Refer to the standards(5) reference page for more information
 about industry standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies  a  string  that is attached to the beginning of
       every message.  Specifies logging options. Values  of  the
       log_option  parameter  include:  Logs  the process ID with
       each message. This option is useful for  identifying  daemons.
   Sends  messages  to  the console if unable to send
       them to syslogd. This option is useful in daemon processes
       that  have  no controlling terminal.  Opens the connection
       to syslogd immediately, instead of when the first  message
       is logged. This option is useful for programs that need to
       manage the order in which file descriptors are  allocated.

              [Tru64  UNIX]  This option is required for programs
              using the chroot system call.  Delays  opening  the
              connection until syslog() is called.  Logs messages
              to the console without waiting for child  processes
              that are forked. Use this option for processes that
              enable notification of termination  of  child  processes
  through  SIGCHLD;  otherwise,  the syslog()
              function may block, waiting  for  a  child  process
              whose  exit  status  has  already  been  collected.
              Specifies the facility that generated the  message,
              which  is  one of the following: [Tru64 UNIX]  Messages
 generated by the kernel. These cannot be generated
  by  any user processes.  Messages generated
              by user processes. This  is  the  default  facility
              when  none  is  specified.   [Tru64 UNIX]  Messages
              generated by the mail system.   [Tru64  UNIX]  Messages
   generated   by   system   daemons.   [Tru64
              UNIX]  Messages generated by the authorization system:
  login, su, and so on.  [Tru64 UNIX]  Messages
              generated by  the  line  printer  spooling  system.
              [Tru64  UNIX]  Messages  generated  by  remote file
              systems.  Reserved for local use.

              This parameter encodes a default facility from  the
              previous  list  to  be assigned to messages that do
              not have an explicit  facility  encoded.   Messages
              are tagged with codes indicating the type of priority
 for each.  The priority parameter is encoded as
              a  facility (as previously listed), which describes
              the part of the system generating the message,  and
              as  a  level,  which  indicates the severity of the
              message. The level of severity is selected from the
              following  list:  A panic condition was reported to
              all users.  Specifies a condition to  be  corrected
              immediately,  for  example,  a  corrupted database.
              Specifies a critical conditions, for example,  hard
              device  errors.  Specifies errors.  Specifies warning
 messages.  Specifies that it is  not  an  error
              condition,  but  a condition requiring special handling.
   Specifies  general  information  messages.
              Specifies messages containing information useful in
              debugging a program.  Similar  to  the  printf  fmt
              string,  with the difference that %m is replaced by
              the current error message obtained from  errno.   A
              trailing  newline  can  be  added to the message if
              needed. The value parameters are the  same  as  the
              value  parameters of the printf() function. Callers
              of syslog() must ensure that  the  message  is  not
              longer than LINE_MAX bytes. Results are unspecified
              if syslog() is called with a  message  larger  than
              LINE_MAX  bytes.   Specifies a bit mask used to set
              the new log priority mask and return  the  previous
              mask.   The  LOG_MASK  and  LOG_UPTO  macros in the
              sys/syslog.h file are used to create  the  priority
              mask.  [Tru64 UNIX]  The closelog_r(), openlog_r(),
              setlogmask_r(), and syslog_r() functions  use  this
              opaque structure.

DESCRIPTION    [Toc]    [Back]

       The  syslog()  function  writes messages to the system log
       maintained by the syslogd daemon.

       The syslogd daemon reads messages and writes them  to  the
       system  console  or to a log file, or forwards them to the
       syslogd daemon on the appropriate host.

       If the syslog() function cannot pass the message  to  syslogd,
  it writes the message on /dev/console, provided the
       LOG_CONS option is set.

       If special processing is required, the openlog()  function
       can be used to initialize the log file.

       [Tru64  UNIX]  If  a  program  is  using the chroot system
       call, the syslog routine will not  work  correctly  unless
       the  program  calls the openlog or openlog_r routine prior
       to making the call to chroot .

       The closelog() function closes the log file.

       The  setlogmask()  function  uses  the  bit  mask  in  the
       mask_priority  parameter  to set the new log priority mask
       and returns the previous mask. Logging is enabled for  the
       levels  indicated by the bits in the mask that are set and
       is disabled where the bits are not set.  The default  mask
       allows  all priorities to be logged. If the syslog() function
 is called with a priority mask that  does  not  allow
       logging  of  that  level  of  message,  then  the function
       returns without logging the message.

       The log_option, facility, and priority macros are  defined
       in the <sys/syslog_pri.h> file.

NOTES    [Toc]    [Back]

       [Tru64  UNIX]  The  closelog_r(), openlog_r, syslog_r, and
       setlogmask_r functions use the  syslog_data  structure  to
       maintain syslog access state. They can be used in place of
       closelog(), openlog(), syslog(), and setlogmask() when  it
       is necessary to have a unique set of IDs, options, facilities,
 or masks for each thread in a multithreaded application.
 The data object syslog_data should be initialized to
       SYSLOG_DATA_INIT.

RETURN VALUES    [Toc]    [Back]

       [XSH4.2]  The setlogmask() function returns  the  previous
       log priority mask. The closelog(), openlog(), and syslog()
       functions return no value.

       [Tru64 UNIX]  The backward-compatible version of the  syslog()
  function returns a value of -1 if either the priority
 mask excludes this message from being logged, or if an
       error  occurs  and it is impossible to send the message to
       the syslogd daemon or to the system console.

       [Tru64 UNIX]  Upon successful  completion,  the  backwardcompatible
  version  of  the  openlog() function returns a
       value of 0 (zero).  Otherwise, a value of -1  is  returned
       and errno is set to indicate the error.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: profil(2)

       Standards: standards(5)



                                                        syslog(3)
[ Back ]
 Similar pages
Name OS Title
fsctl HP-UX file system control
getrlimit IRIX control maximum system resource consumption
getrlimit Tru64 Control maximum system resource consumption
vxfsio HP-UX VxFS file system control functions
setrlimit Tru64 Control maximum system resource consumption
vidcontrol FreeBSD system console control and configuration utility
getrlimit OpenBSD control maximum system resource consumption
getrlimit NetBSD control maximum system resource consumption
setrlimit NetBSD control maximum system resource consumption
getrlimit FreeBSD control maximum system resource consumption
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service