| 1 | .\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 |
| 2 | .\" |
| 3 | .\" Standard preamble: |
| 4 | .\" ======================================================================== |
| 5 | .de Sh \" Subsection heading |
| 6 | .br |
| 7 | .if t .Sp |
| 8 | .ne 5 |
| 9 | .PP |
| 10 | \fB\\$1\fR |
| 11 | .PP |
| 12 | .. |
| 13 | .de Sp \" Vertical space (when we can't use .PP) |
| 14 | .if t .sp .5v |
| 15 | .if n .sp |
| 16 | .. |
| 17 | .de Vb \" Begin verbatim text |
| 18 | .ft CW |
| 19 | .nf |
| 20 | .ne \\$1 |
| 21 | .. |
| 22 | .de Ve \" End verbatim text |
| 23 | .ft R |
| 24 | .fi |
| 25 | .. |
| 26 | .\" Set up some character translations and predefined strings. \*(-- will |
| 27 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
| 28 | .\" double quote, and \*(R" will give a right double quote. | will give a |
| 29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to |
| 30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' |
| 31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. |
| 32 | .tr \(*W-|\(bv\*(Tr |
| 33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
| 34 | .ie n \{\ |
| 35 | . ds -- \(*W- |
| 36 | . ds PI pi |
| 37 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
| 38 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
| 39 | . ds L" "" |
| 40 | . ds R" "" |
| 41 | . ds C` "" |
| 42 | . ds C' "" |
| 43 | 'br\} |
| 44 | .el\{\ |
| 45 | . ds -- \|\(em\| |
| 46 | . ds PI \(*p |
| 47 | . ds L" `` |
| 48 | . ds R" '' |
| 49 | 'br\} |
| 50 | .\" |
| 51 | .\" If the F register is turned on, we'll generate index entries on stderr for |
| 52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index |
| 53 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
| 54 | .\" output yourself in some meaningful fashion. |
| 55 | .if \nF \{\ |
| 56 | . de IX |
| 57 | . tm Index:\\$1\t\\n%\t"\\$2" |
| 58 | .. |
| 59 | . nr % 0 |
| 60 | . rr F |
| 61 | .\} |
| 62 | .\" |
| 63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 64 | .\" way too many mistakes in technical documents. |
| 65 | .hy 0 |
| 66 | .if n .na |
| 67 | .\" |
| 68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
| 69 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
| 70 | . \" fudge factors for nroff and troff |
| 71 | .if n \{\ |
| 72 | . ds #H 0 |
| 73 | . ds #V .8m |
| 74 | . ds #F .3m |
| 75 | . ds #[ \f1 |
| 76 | . ds #] \fP |
| 77 | .\} |
| 78 | .if t \{\ |
| 79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
| 80 | . ds #V .6m |
| 81 | . ds #F 0 |
| 82 | . ds #[ \& |
| 83 | . ds #] \& |
| 84 | .\} |
| 85 | . \" simple accents for nroff and troff |
| 86 | .if n \{\ |
| 87 | . ds ' \& |
| 88 | . ds ` \& |
| 89 | . ds ^ \& |
| 90 | . ds , \& |
| 91 | . ds ~ ~ |
| 92 | . ds / |
| 93 | .\} |
| 94 | .if t \{\ |
| 95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
| 96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
| 97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
| 98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
| 99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
| 100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
| 101 | .\} |
| 102 | . \" troff and (daisy-wheel) nroff accents |
| 103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
| 104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
| 105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
| 106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
| 107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
| 108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
| 109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
| 110 | .ds ae a\h'-(\w'a'u*4/10)'e |
| 111 | .ds Ae A\h'-(\w'A'u*4/10)'E |
| 112 | . \" corrections for vroff |
| 113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
| 114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
| 115 | . \" for low resolution devices (crt and lpr) |
| 116 | .if \n(.H>23 .if \n(.V>19 \ |
| 117 | \{\ |
| 118 | . ds : e |
| 119 | . ds 8 ss |
| 120 | . ds o a |
| 121 | . ds d- d\h'-1'\(ga |
| 122 | . ds D- D\h'-1'\(hy |
| 123 | . ds th \o'bp' |
| 124 | . ds Th \o'LP' |
| 125 | . ds ae ae |
| 126 | . ds Ae AE |
| 127 | .\} |
| 128 | .rm #[ #] #H #V #F C |
| 129 | .\" ======================================================================== |
| 130 | .\" |
| 131 | .IX Title "Sys::Syslog 3" |
| 132 | .TH Sys::Syslog 3 "2002-06-01" "perl v5.8.0" "Perl Programmers Reference Guide" |
| 133 | .SH "NAME" |
| 134 | Sys::Syslog, openlog, closelog, setlogmask, syslog \- Perl interface to the UNIX syslog(3) calls |
| 135 | .SH "SYNOPSIS" |
| 136 | .IX Header "SYNOPSIS" |
| 137 | .Vb 2 |
| 138 | \& use Sys::Syslog; # all except setlogsock, or: |
| 139 | \& use Sys::Syslog qw(:DEFAULT setlogsock); # default set, plus setlogsock |
| 140 | .Ve |
| 141 | .PP |
| 142 | .Vb 5 |
| 143 | \& setlogsock $sock_type; |
| 144 | \& openlog $ident, $logopt, $facility; |
| 145 | \& syslog $priority, $format, @args; |
| 146 | \& $oldmask = setlogmask $mask_priority; |
| 147 | \& closelog; |
| 148 | .Ve |
| 149 | .SH "DESCRIPTION" |
| 150 | .IX Header "DESCRIPTION" |
| 151 | Sys::Syslog is an interface to the \s-1UNIX\s0 \f(CWsyslog(3)\fR program. |
| 152 | Call \f(CW\*(C`syslog()\*(C'\fR with a string priority and a list of \f(CW\*(C`printf()\*(C'\fR args |
| 153 | just like \f(CWsyslog(3)\fR. |
| 154 | .PP |
| 155 | Syslog provides the functions: |
| 156 | .ie n .IP "openlog $ident\fR, \f(CW$logopt\fR, \f(CW$facility" 4 |
| 157 | .el .IP "openlog \f(CW$ident\fR, \f(CW$logopt\fR, \f(CW$facility\fR" 4 |
| 158 | .IX Item "openlog $ident, $logopt, $facility" |
| 159 | \&\fI$ident\fR is prepended to every message. \fI$logopt\fR contains zero or |
| 160 | more of the words \fIpid\fR, \fIndelay\fR, \fInowait\fR. The cons option is |
| 161 | ignored, since the failover mechanism will drop down to the console |
| 162 | automatically if all other media fail. \fI$facility\fR specifies the |
| 163 | part of the system |
| 164 | .ie n .IP "syslog $priority\fR, \f(CW$format\fR, \f(CW@args" 4 |
| 165 | .el .IP "syslog \f(CW$priority\fR, \f(CW$format\fR, \f(CW@args\fR" 4 |
| 166 | .IX Item "syslog $priority, $format, @args" |
| 167 | If \fI$priority\fR permits, logs \fI($format, \f(CI@args\fI)\fR |
| 168 | printed as by \f(CW\*(C`printf(3V)\*(C'\fR, with the addition that \fI%m\fR |
| 169 | is replaced with \f(CW"$!"\fR (the latest error message). |
| 170 | .ie n .IP "setlogmask $mask_priority" 4 |
| 171 | .el .IP "setlogmask \f(CW$mask_priority\fR" 4 |
| 172 | .IX Item "setlogmask $mask_priority" |
| 173 | Sets log mask \fI$mask_priority\fR and returns the old mask. |
| 174 | .ie n .IP "setlogsock $sock_type [$stream_location] (added in 5.004_02)" 4 |
| 175 | .el .IP "setlogsock \f(CW$sock_type\fR [$stream_location] (added in 5.004_02)" 4 |
| 176 | .IX Item "setlogsock $sock_type [$stream_location] (added in 5.004_02)" |
| 177 | Sets the socket type to be used for the next call to |
| 178 | \&\f(CW\*(C`openlog()\*(C'\fR or \f(CW\*(C`syslog()\*(C'\fR and returns \s-1TRUE\s0 on success, |
| 179 | undef on failure. |
| 180 | .Sp |
| 181 | A value of 'unix' will connect to the \s-1UNIX\s0 domain socket returned by |
| 182 | the \f(CW\*(C`_PATH_LOG\*(C'\fR macro (if your system defines it) in \fIsyslog.ph\fR. A |
| 183 | value of 'stream' will connect to the stream indicated by the pathname |
| 184 | provided as the optional second parameter. A value of 'inet' will |
| 185 | connect to an \s-1INET\s0 socket (either tcp or udp, tried in that order) |
| 186 | returned by \fIgetservbyname()\fR. 'tcp' and 'udp' can also be given as |
| 187 | values. The value 'console' will send messages directly to the |
| 188 | console, as for the 'cons' option in the logopts in \fIopenlog()\fR. |
| 189 | .Sp |
| 190 | A reference to an array can also be passed as the first parameter. |
| 191 | When this calling method is used, the array should contain a list of |
| 192 | sock_types which are attempted in order. |
| 193 | .Sp |
| 194 | The default is to try tcp, udp, unix, stream, console. |
| 195 | .Sp |
| 196 | Giving an invalid value for sock_type will croak. |
| 197 | .IP "closelog" 4 |
| 198 | .IX Item "closelog" |
| 199 | Closes the log file. |
| 200 | .PP |
| 201 | Note that \f(CW\*(C`openlog\*(C'\fR now takes three arguments, just like \f(CWopenlog(3)\fR. |
| 202 | .SH "EXAMPLES" |
| 203 | .IX Header "EXAMPLES" |
| 204 | .Vb 4 |
| 205 | \& openlog($program, 'cons,pid', 'user'); |
| 206 | \& syslog('info', 'this is another test'); |
| 207 | \& syslog('mail|warning', 'this is a better test: %d', time); |
| 208 | \& closelog(); |
| 209 | .Ve |
| 210 | .PP |
| 211 | .Vb 1 |
| 212 | \& syslog('debug', 'this is the last test'); |
| 213 | .Ve |
| 214 | .PP |
| 215 | .Vb 3 |
| 216 | \& setlogsock('unix'); |
| 217 | \& openlog("$program $$", 'ndelay', 'user'); |
| 218 | \& syslog('notice', 'fooprogram: this is really done'); |
| 219 | .Ve |
| 220 | .PP |
| 221 | .Vb 3 |
| 222 | \& setlogsock('inet'); |
| 223 | \& $! = 55; |
| 224 | \& syslog('info', 'problem was %m'); # %m == $! in syslog(3) |
| 225 | .Ve |
| 226 | .SH "SEE ALSO" |
| 227 | .IX Header "SEE ALSO" |
| 228 | \&\fIsyslog\fR\|(3) |
| 229 | .SH "AUTHOR" |
| 230 | .IX Header "AUTHOR" |
| 231 | Tom Christiansen <\fItchrist@perl.com\fR> and Larry Wall |
| 232 | <\fIlarry@wall.org\fR>. |
| 233 | .PP |
| 234 | \&\s-1UNIX\s0 domain sockets added by Sean Robinson |
| 235 | <\fIrobinson_s@sc.maricopa.edu\fR> with support from Tim Bunce |
| 236 | <\fITim.Bunce@ig.co.uk\fR> and the perl5\-porters mailing list. |
| 237 | .PP |
| 238 | Dependency on \fIsyslog.ph\fR replaced with \s-1XS\s0 code by Tom Hughes |
| 239 | <\fItom@compton.nu\fR>. |
| 240 | .PP |
| 241 | Code for \fIconstant()\fRs regenerated by Nicholas Clark <\fInick@ccl4.org\fR>. |
| 242 | .PP |
| 243 | Failover to different communication modes by Nick Williams |
| 244 | <\fINick.Williams@morganstanley.com\fR>. |