1logger(1) User Commands logger(1)
2
3
4
6 logger - add entries to the system log
7
9 logger [-i] [-f file] [-p priority] [-t tag] [message] ...
10
11
13 The logger command provides a method for adding one-line entries to the
14 system log file from the command line. One or more message arguments
15 can be given on the command line, in which case each is logged immedi‐
16 ately. If this is unspecified, either the file indicated with -f or the
17 standard input is added to the log. Otherwise, a file can be speci‐
18 fied, in which case each line in the file is logged. If neither is
19 specified, logger reads and logs messages on a line-by-line basis from
20 the standard input.
21
23 The following options are supported:
24
25 -ffile Uses the contents of file as the message to log.
26
27
28 -i Logs the process ID of the logger process with each line.
29
30
31 -ppriority Enters the message with the specified priority. The mes‐
32 sage priority can be specified numerically, or as a
33 facility.level pair. For example, `-p local3.info'
34 assigns the message priority to the info level in the
35 local3 facility. The default priority is user.notice.
36
37
38 -ttag Marks each line added to the log with the specified tag.
39
40
42 The following operand is supported:
43
44 message One of the string arguments whose contents are concatenated
45 together, in the order specified, separated by single space
46 characters.
47
48
50 Example 1 Examples of the logger command
51
52
53 The following example:
54
55
56 example% logger System rebooted
57
58
59
60
61 logs the message `System rebooted' to the default priority level notice
62 to be treated by syslogd as are other messages to the facility user.
63
64
65
66 The next example:
67
68
69 example% logger -p local0.notice -t HOSTIDM -f /dev/idmc
70
71
72
73
74 reads from the file /dev/idmc and logs each line in that file as a mes‐
75 sage with the tag `HOSTIDM' at priority level notice to be treated by
76 syslogd as are other messages to the facility local0.
77
78
80 See environ(5) for descriptions of the following environment variables
81 that affect the execution of logger: LANG, LC_ALL, LC_CTYPE, LC_MES‐
82 SAGES, and NLSPATH.
83
85 The following exit values are returned:
86
87 0 Successful completion.
88
89
90 >0 An error occurred.
91
92
94 See attributes(5) for descriptions of the following attributes:
95
96
97
98
99 ┌─────────────────────────────┬─────────────────────────────┐
100 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
101 ├─────────────────────────────┼─────────────────────────────┤
102 │Availability │SUNWcsu │
103 ├─────────────────────────────┼─────────────────────────────┤
104 │Interface Stability │Standard │
105 └─────────────────────────────┴─────────────────────────────┘
106
108 mailx(1), write(1), syslogd(1M), syslog(3C), attributes(5), environ(5),
109 standards(5)
110
111
112
113SunOS 5.11 1 Feb 1995 logger(1)