Mailutils logger

From Mailutils

Revision as of 11:05, 11 July 2015 by Gray (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The mailutils logger tool logs information using Mailutils log facility.


 mailutils logger [options] [message]

The message argument, if supplied, gives the text to log. If not supplied, the utility reads lines of text from standard input or a file (if the --file option is given) and sends them to log:

 # Send text to log
 $ mailutils logger I am here
 # Log each line from file.txt
 $ mailutils logger --file file.txt
 # Read stdin and log it:
 $ mailutils logger

The default logging channel is bound to standard error. To bind it to syslog, use the --syslog command line option. In that case mailutils uses facility user and priority err. You can change this by using the --priority (-p) option. Its argument is either a syslog facility name or facility and severity names separated by a dot. Thus, the following invocation will use facility auth, severity info:

 mailutils logger --priority

The syslog tag can be set using the --tag (-t) option:

 mailutils logger --tag myprog

The default tag is mu-logger.

The --severity (-s) option sets the Mailutils severity level. Its argument can be any of the following strings: debug, info, notice, warning, error, crit, alert, emerg.

Finally, the --locus (-l) option binds log messages to a location in a file. Its argument has the following syntax:


where file is the file name, line is the line number and optional col is the column number in that file.

For example, the following invocation:

 mailutils logger --locus mailutils.rc:34 Suspicious statement

will send the following to the log:

 mailutils-logger: mailutils.rc:34: Suspicious statement

See also

Personal tools