Man Pages

syslog - phpMan syslog - phpMan

Command: man perldoc info search(apropos)  

File:,  Node: syslog; vsyslog,  Next: closelog,  Prev: openlog,  Up: Submitting Syslog Messages

18.2.2 syslog, vsyslog

The symbols referred to in this section are declared in the file

 -- Function: void syslog (int FACILITY_PRIORITY, char *FORMAT, ...)
     `syslog' submits a message to the Syslog facility.  It does this by
     writing to the Unix domain socket `/dev/log'.

     `syslog' submits the message with the facility and priority
     indicated by FACILITY_PRIORITY.  The macro `LOG_MAKEPRI' generates
     a facility/priority from a facility and a priority, as in the
     following example:


     The possible values for the facility code are (macros):

          A miscellaneous user process


          A miscellaneous system daemon

          Security (authorization)


          Central printer

          Network news (e.g. Usenet)


          Cron and At

          Private security (authorization)

          Ftp server

          Locally defined

          Locally defined

          Locally defined

          Locally defined

          Locally defined

          Locally defined

          Locally defined

          Locally defined

     Results are undefined if the facility code is anything else.

     *NB:* `syslog' recognizes one other facility code: that of the
     kernel.  But you can't specify that facility code with these
     functions.  If you try, it looks the same to `syslog' as if you are
     requesting the default facility.  But you wouldn't want to anyway,
     because any program that uses the GNU C library is not the kernel.

     You can use just a priority code as FACILITY_PRIORITY.  In that
     case, `syslog' assumes the default facility established when the
     Syslog connection was opened.  *Note Syslog Example::.

     The possible values for the priority code are (macros):

          The message says the system is unusable.

          Action on the message must be taken immediately.

          The message states a critical condition.

          The message describes an error.

          The message is a warning.

          The message describes a normal but important event.

          The message is purely informational.

          The message is only for debugging purposes.

     Results are undefined if the priority code is anything else.

     If the process does not presently have a Syslog connection open
     (i.e., it did not call `openlog'), `syslog' implicitly opens the
     connection the same as `openlog' would, with the following defaults
     for information that would otherwise be included in an `openlog'
     call: The default identification string is the program name.  The
     default default facility is `LOG_USER'.  The default for all the
     connection options in OPTIONS is as if those bits were off.
     `syslog' leaves the Syslog connection open.

     If the `dev/log' socket is not open and connected, `syslog' opens
     and connects it, the same as `openlog' with the `LOG_NDELAY'
     option would.

     `syslog' leaves `/dev/log' open and connected unless its attempt
     to send the message failed, in which case `syslog' closes it (with
     the hope that a future implicit open will restore the Syslog
     connection to a usable state).


          #include <syslog.h>
          syslog (LOG_MAKEPRI(LOG_LOCAL1, LOG_ERROR),
                  "Unable to make network connection to %s.  Error=%m", host);

 -- Function: void vsyslog (int FACILITY_PRIORITY, char *FORMAT,
          va_list arglist)
     This is functionally identical to `syslog', with the BSD style
     variable length argument.