Format
logger [–IisTu]
[–d dest] [–f filename]
[–p priority]
[–t tag] [–a tag2] string
…
Description
logger saves
a message in the console log; the message consists of the string operand
on the command line. Some options of logger might
be in effect by default. If they are on by default, they cannot be
disabled.
The -u and -i options
are in effect by default. As a result, all messages from logger
are prefixed by the process ID and user login user name.
If
there is no message specified on the command line, the standard input
is read. Because each line of standard input is treated as a log message,
all terminal input is logged as a message. To prevent all subsequent
input from being processed by logger , enter the
designated escape character, such as ¢, followed
by a capital C. For example: ¢C.
If –f filename is
specified, the file is read instead of the standard input.
Options
- –f filename
- Reads log messages from the file filename rather
than from the standard input.
- –I
- Adds the parent process ID (PPID) of logger
to the message.
- –i
- Adds the process ID (PID) of logger to the
message. This option is in effect by default, so all messages from logger
are prefixed by the PID.
- –s
- Overrides any destination options and causes logging to the standard
error output.
- –T
- Adds a time stamp (%x %X format, per date) to
the message. This time stamp is always in the POSIX locale, no matter
the locale of the message.
- –u
- Adds the login name of the controlling terminal to the message.
This option is in effect by default, so all messages from logger
are prefixed by the login name.
Note: The following options work on z/OS systems.
However, because they are system-specific, they might not work on
another system.
- –d destination
- Must be a list of numbers, separated by spaces, tabs, or commas,
in the range of 1 to 128, and represents a bit in the routing code
number (that is, ROUTCDE=) in the WTO macro. The default destination
value is 0 (no bits set in the routing code number).
If you use d1, the message goes to the
system console.
- –p priority
- Must be a list of numbers, separated by spaces, tabs, or commas,
in the range of 1 to 16 and represents a bit in the message descriptor
code (that is, DESC=) in the WTO macro (WTO == write to operator).
The default priority value is 0 (that is, no bits set).
- –t tag
- Adds tag to the start of the message.
- –a tag2
- Adds tag2 in front of all the options
and the message.
For more information about the destination and priority options,
refer to z/OS MVS JCL Reference.
Examples
- If you issue:
logger -d1 This is a message.
(Note
the number 1.) You will see: +WELLIE4: 2097152017: This is a message.
- If you issue:
logger -d1 -a TheTag A message
(Note the number
1.) You will see: +TheTag: WELLIE4: 213076449: A message.
Localization
logger uses
the following localization environment variables:
- LANG
- LC_ALL
- LC_CTYPE
- LC_MESSAGES
- NLSPATH
See Localization for more
information.
Exit values
- 0
- Successful completion
- >0
- An error occurred
Messages
Possible error messages include:
- -f filename invalid if message given
- Both a file name and message was specified; only one is allowed.
- file filename: system error
- The file specified by –f filename could
not be opened.
- Formatted log message too long -- limit LINE_MAX (number)
- The log message specified was longer than the limit specified
by LINE_MAX.
- Unknown option option
- You specified an incorrect option to logger .
Portability
POSIX.2, X/Open Portability Guide.
All
the options are extensions of the POSIX standard.