OSDN Git Service

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