OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / syslog.3
1 .\" Written  Feb 1994 by Steve Greenland (stevegr@neosoft.com)
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Updated 1999.12.19 by Karl M. Hegbloom <karlheg@debian.org>
26 .\"
27 .\" Updated 13 Oct 2001, Michael Kerrisk <mtk.manpages@gmail.com>
28 .\"     Added description of vsyslog
29 .\"     Added descriptions of LOG_ODELAY and LOG_NOWAIT
30 .\"     Added brief description of facility and option arguments
31 .\"     Added CONFORMING TO section
32 .\" 2001-10-13, aeb, minor changes
33 .\" Modified 13 Dec 2001, Martin Schulze <joey@infodrom.org>
34 .\" Modified 3 Jan 2002, Michael Kerrisk <mtk.manpages@gmail.com>
35 .\"
36 .\"*******************************************************************
37 .\"
38 .\" This file was generated with po4a. Translate the source file.
39 .\"
40 .\"*******************************************************************
41 .\"
42 .\" Translated Sep 1 20:14:01 JST 1996
43 .\"     by Shoichi OZAWA <ozawa@omika.hitachi.co.jp>
44 .\" Updated Thu Oct 18 01:00:02 JST 2001
45 .\"     by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
46 .\" Updated Fri Jan 4 22:15:21 JST 2002
47 .\"     by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
48 .\" Updated 2002-04-14 by Kentaro Shirakata <argrath@ub32.org>
49 .\" Updated 2007-01-01 by Kentaro Shirakata <argrath@ub32.org>
50 .\" Updated 2012-05-29, Akihiro MOTOKI <amotoki@gmail.com>
51 .\" Updated 2013-03-26, Akihiro MOTOKI <amotoki@gmail.com>
52 .\"
53 .TH SYSLOG 3 2012\-08\-17 Linux "Linux Programmer's Manual"
54 .SH 名前
55 closelog, openlog, syslog, vsyslog \- システムロガーにメッセージを送る
56 .SH 書式
57 \fB#include <syslog.h>\fP
58 .sp
59 \fBvoid openlog(const char *\fP\fIident\fP\fB, int \fP\fIoption\fP\fB, int
60 \fP\fIfacility\fP\fB);\fP
61 .br
62 \fBvoid syslog(int \fP\fIpriority\fP\fB, const char *\fP\fIformat\fP\fB, ...);\fP
63 .br
64 \fBvoid closelog(void);\fP
65 .sp
66 \fB#include <stdarg.h>\fP
67 .sp
68 \fBvoid vsyslog(int \fP\fIpriority\fP\fB, const char *\fP\fIformat\fP\fB, va_list
69 \fP\fIap\fP\fB);\fP
70 .sp
71 .in -4n
72 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
73 .in
74 .sp
75 \fBvsyslog\fP(): _BSD_SOURCE
76 .SH 説明
77 \fBcloselog\fP()  はシステムのログ記録用プログラム(システムロガー \fBsyslogd\fP(8))  ヘの接続を終了する。
78 \fBcloselog\fP()  は必須ではない。
79 .sp
80 \fBopenlog\fP() はログを出力しようとしているプログラムからログ記録用
81 プログラム (system logger) への 接続を開始する。
82 \fIident\fP で指定した文字列は各メッセージの前に付与される。
83 通常は \fIident\fP にはプログラム名が設定される。
84 \fIident\fP が NULL の場合、プログラムが \fIident\fP として使用される
85 (POSIX.1\-2008 では \fIident\fP が NULL の場合の動作は規定されていない)。
86
87 \fIoption\fP 引き数は、 \fBopenlog\fP() の動作とその後の \fBsyslog\fP() の呼び
88 出しを制御するフラグを指定する。 \fIfacility\fP 引き数は、後で \fBsyslog\fP()
89 を呼び出す際に facility が指定されなかった場合に使用される デフォルト値
90 を決定する。 \fIoption\fP と \fIfacility\fP については後述する。
91 \fBopenlog\fP() は必須ではなく、必要に応じて \fBsyslog\fP() から呼び出される。
92 \fBsyslog\fP() が呼び出した場合、 \fIident\fP のデフォルト値は NULL になる。
93 .sp
94 \fBsyslog\fP()  はログメッセージを出力し、 \fBsyslogd\fP(8)  がそのメッセージを記録する。 \fIpriority\fP 引き数は
95 \fIfacility\fP と \fIlevel\fP との組合せで指定する。 \fIfacility\fP と \fIlevel\fP の取りうる値は後述する。 残りの
96 \fIformat\fP 引き数は \fBprintf\fP(3)  と似たスタイルの書式とその書式に与える値である。 \fIformat\fP 中の2文字 \fB%m\fP
97 はその時点での \fIerrno\fP に関連するエラーメッセージ文字列 (\fIstrerror\fP)  によって置き換えられる。
98 必要な場合は末尾に改行が加えられる。
99
100 \fBvsyslog\fP()  関数は \fBsyslog\fP()  と同じ機能を持つが、可変引き数リストを指定することができる点が異なる。
101 指定された引き数は、 \fBstdarg\fP(3)  可変引き数リストマクロを用いて取得される。
102
103 以下のサブセクションでは、 \fIoption\fP と \fIfacility\fP と \fIpriority\fP
104 の値を設定するのに使用されるパラメータを説明する。
105 .SS option
106 下記の値を OR したものが \fBopenlog\fP()  の \fIoption\fP 引き数になる:
107 .TP  15
108 \fBLOG_CONS\fP
109 エラーがあれば、システムロガーに送る一方でシステムコンソールにも直接書く。
110 .TP 
111 \fBLOG_NDELAY\fP
112 ログ記録用プログラムとの接続を即座に開始する (通常は、最初のメッセージが記録される時に接続を開く)。
113 .TP 
114 \fBLOG_NOWAIT\fP
115 メッセージを記録する際に生成される子プロセスの終了を待たない。 (GNU C ライブラリは子プロセスを生成しない。 したがって、このオプションは
116 Linux では無効である。)
117 .TP 
118 \fBLOG_ODELAY\fP
119 \fBLOG_NDELAY\fP の反対。 \fBsyslog\fP()  が呼ばれるまで、接続の開始を行わない。
120 (このオプションはデフォルトであり、特に指定する必要はない。)
121 .TP 
122 \fBLOG_PERROR\fP
123 stderr にも出力する。
124 (POSIX.1\-2001 と POSIX.1\-2008 では定義されていない)
125 .TP 
126 \fBLOG_PID\fP
127 個々のメッセージに PID を含める。
128 .SS facility
129 \fIfacility\fP 引き数はメッセージに記録されるプログラムのタイプを指定するために使われる。
130 これによって異なるタイプのプログラムからのメッセージは異なる扱いを するように設定ファイル( \fBsyslog.conf\fP(5))  に定義できる。
131 .TP  15
132 \fBLOG_AUTH\fP
133 セキュリティ/認証 メッセージ
134 .TP 
135 \fBLOG_AUTHPRIV\fP
136 セキュリティ/認証 メッセージ (プライベート)
137 .TP 
138 \fBLOG_CRON\fP
139 クロックデーモン (\fBcron\fP と at\fB)\fP
140 .TP 
141 \fBLOG_DAEMON\fP
142 特定の facility 値を持たないシステムデーモン
143 .TP 
144 \fBLOG_FTP\fP
145 ftp デーモン
146 .TP 
147 \fBLOG_KERN\fP
148 .\" LOG_KERN has the value 0; if used as a facility, zero translates to:
149 .\" "use the default facility".
150 カーネルメッセージ (ユーザプロセスから生成することはできない)
151 .TP 
152 \fBLOG_LOCAL0\fP から \fBLOG_LOCAL7\fP
153 ローカルな使用のためにリザーブされている
154 .TP 
155 \fBLOG_LPR\fP
156 ラインプリンタ・サブシステム
157 .TP 
158 \fBLOG_MAIL\fP
159 メール・サブシステム
160 .TP 
161 \fBLOG_NEWS\fP
162 USENET ニュース・サブシステム
163 .TP 
164 \fBLOG_SYSLOG\fP
165 \fBsyslogd\fP(8)  によって内部的に発行されるメッセージ
166 .TP 
167 \fBLOG_USER\fP (デフォルト)
168 一般的なユーザレベルメッセージ
169 .TP 
170 \fBLOG_UUCP\fP
171 UUCPサブシステム
172 .SS level
173 これはメッセージの優先度を指定する。 優先度の高いものから低いものの順で下記する。
174 .TP  15
175 \fBLOG_EMERG\fP
176 システムが使用不可
177 .TP 
178 \fBLOG_ALERT\fP
179 直ちに行動を起こさなければならない
180 .TP 
181 \fBLOG_CRIT\fP
182 危険な状態
183 .TP 
184 \fBLOG_ERR\fP
185 エラーの状態
186 .TP 
187 \fBLOG_WARNING\fP
188 ワーニングの状態
189 .TP 
190 \fBLOG_NOTICE\fP
191 通常だが重要な状態
192 .TP 
193 \fBLOG_INFO\fP
194 インフォメーションメッセージ
195 .TP 
196 \fBLOG_DEBUG\fP
197 デバッグレベルのメッセージ
198 .LP
199 \fBsetlogmask\fP(3)  関数を使用して、 指定されたレベルのメッセージだけを記録するように 制限することができる。
200 .SH 準拠
201 .\" .SH HISTORY
202 .\" A
203 .\" .BR syslog ()
204 .\" function call appeared in 4.2BSD.
205 .\" 4.3BSD documents
206 .\" .BR openlog (),
207 .\" .BR syslog (),
208 .\" .BR closelog (),
209 .\" and
210 .\" .BR setlogmask ().
211 .\" 4.3BSD-Reno also documents
212 .\" .BR vsyslog ().
213 .\" Of course early v* functions used the
214 .\" .I <varargs.h>
215 .\" mechanism, which is not compatible with
216 .\" .IR <stdarg.h> .
217 \fBopenlog\fP(), \fBcloselog\fP(), \fBsyslog\fP() は SUSv2, POSIX.1\-2001,
218 POSIX.1\-2008 で規定されている (但し \fBvsyslog\fP() は除く)。
219 POSIX.1\-2001 では \fIfacility\fP として \fBLOG_USER\fP と \fBLOG_LOCAL*\fP の値
220 が規定されているだけである。 しかしながら、 \fBLOG_AUTHPRIV\fP と
221 \fBLOG_FTP\fP という例外はあるが、 それ以外の \fIfacility\fP の値は多くの
222 UNIX システムで使われている。 \fIoption\fP の値の \fBLOG_PERROR\fP の値は、
223 POSIX.1\-2001 と POSIX.1\-2008 では規定されていないが、
224 UNIX の多くのバージョンで使用可能である。
225 .SH 注意
226 \fBopenlog\fP()  呼び出しの \fIident\fP 引き数は、値がそのまま保持されていることを前提にしている。 それゆえ、 \fIident\fP
227 で指定された文字列が変更されると、 \fBsyslog\fP()  は変更された文字列の追加するだろうし、
228 指定された文字列が存在しなくなった場合、結果は未定義である。 最も移植性がある方法は、文字列定数を使用することである。
229 .LP
230 ユーザーから与えられたデータを format として渡してはならない。 代わりに以下を使うこと。
231 .nf
232
233     syslog(priority, "%s", string);
234 .fi
235 .SH 関連項目
236 \fBlogger\fP(1), \fBsetlogmask\fP(3), \fBsyslog.conf\fP(5), \fBsyslogd\fP(8)
237 .SH この文書について
238 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
239 である。プロジェクトの説明とバグ報告に関する情報は
240 http://www.kernel.org/doc/man\-pages/ に書かれている。