'\" te .\" Copyright (c) 1983 Regents of the University of California.Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved All rights reserved.The Berkeley software License Agreement specifies the terms and conditions for redistribution. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation.Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation.In the following statement, the phrase"this text" refers to portions of the system documentation.Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard,the original IEEE and The Open Group Standard is the referee document.The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.This notice shall appear on any product containing this material. .TH logger 1 "1995 年 2 月 1 日" "SunOS 5.11" "用户命令" .SH 名称 logger \- 向系统日志添加条目 .SH 用法概要 .LP .nf \fBlogger\fR [\fB-i\fR] [\fB-f\fR \fIfile\fR] [\fB-p\fR \fIpriority\fR] [\fB-t\fR \fItag\fR] [\fImessage\fR] ... .fi .SH 描述 .sp .LP \fBlogger\fR 命令提供了一种方法,可将一行条目添加到命令行的系统日志文件。可在命令行提供一个或多个 \fImessage\fR 参数,在此情况下会立即记录每个参数。如果未指定参数,则会将使用 \fB-f\fR 指定的文件或标准输入添加到日志。否则可指定 \fIfile\fR,在此情况下会记录文件中的每一行。如果以上内容都未指定,则 \fBlogger\fR 会从标准输入逐行读取和记录消息。 .SH 选项 .sp .LP 支持以下选项: .sp .ne 2 .mk .na \fB\fB-f\fR\fIfile\fR\fR .ad .RS 14n .rt 使用 \fIfile\fR 的内容作为要记录的消息。 .RE .sp .ne 2 .mk .na \fB\fB-i\fR\fR .ad .RS 14n .rt 在每一行中记录 \fBlogger\fR 进程的进程 \fBID\fR。 .RE .sp .ne 2 .mk .na \fB\fB-p\fR\fIpriority\fR\fR .ad .RS 14n .rt 按指定的 \fIpriority\fR 输入消息。可按数字指定消息优先级,或以 \fIfacility\fR\fB\&.\fR\fIlevel\fR 对指定。例如,"\fB\fR\fB-p\fR\fB local3.info\fR" 会将消息优先级分配至 \fBlocal3\fR 功能中的 \fBinfo\fR 级别。缺省优先级为 \fBuser.notice\fR。 .RE .sp .ne 2 .mk .na \fB\fB-t\fR\fItag\fR\fR .ad .RS 14n .rt 使用指定 \fItag\fR 来标记添加到日志的每一行。 .RE .SH 操作数 .sp .LP 支持下列操作数: .sp .ne 2 .mk .na \fB\fImessage\fR\fR .ad .RS 11n .rt 其内容以指定顺序串联在一起的字符串参数之一,以单个空格字符分隔。 .RE .SH 示例 .LP \fB示例 1 \fR日志记录程序命令示例 .sp .LP 以下示例: .sp .in +2 .nf example% \fBlogger System rebooted\fR .fi .in -2 .sp .sp .LP 将消息 "\fBSystem rebooted\fR" 记录为将由 \fBsyslogd\fR 处理的缺省优先级 \fBnotice\fR,如同其他消息与 \fBuser\fR 功能的关系。 .sp .LP 下一个示例: .sp .in +2 .nf example% \fBlogger -p local0.notice -t HOSTIDM -f /dev/idmc\fR .fi .in -2 .sp .sp .LP 从文件 \fB/dev/idmc\fR 中读取,并使用标签 "\fBHOSTIDM\fR" 在该文件中将每行记录为消息(采用将由 \fBsyslogd\fR 处理的优先级 \fBnotice\fR),如同其他消息与 \fBlocal0\fR 功能的关系。 .SH 环境变量 .sp .LP 有关影响 \fBlogger\fR 执行的以下环境变量的说明,请参见 \fBenviron\fR(5):\fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR 和 \fBNLSPATH\fR。 .SH 退出状态 .sp .LP 将返回以下退出值: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 6n .rt 成功完成。 .RE .sp .ne 2 .mk .na \fB\fB>0\fR\fR .ad .RS 6n .rt 出现错误。 .RE .SH 属性 .sp .LP 有关下列属性的说明,请参见 \fBattributes\fR(5): .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性类型属性值 _ 可用性system/core-os _ 接口稳定性Committed(已确定) _ 标准请参见 \fBstandards\fR(5)。 .TE .SH 另请参见 .sp .LP \fBmailx\fR(1)、\fBwrite\fR(1)、\fBsyslogd\fR(1M)、\fBsyslog\fR(3C)、\fBattributes\fR(5)、\fBenviron\fR(5)、\fBstandards\fR(5)