Writes a string to the system log file.
An ordinary user can run this without read or write permission on the system log file. It simply adds a date stamp, your login name, and whatever arguments you gave it:
$ logger fooey $ tail -1 /var/log/system.log Dec 12 08:35:03 localhost apl: fooey
There are more possibilities: you can specify a priority level, and that could cause your message to go to some other system log depending on the configuration of syslog:
apl$ sudo cat /etc/syslog.conf *.err;kern.*;auth.notice;authpriv,remoteauth,install.none;mail.crit /dev/console *.notice;*.info;authpriv,remoteauth,ftp,install.none;kern.debug;mail.crit /var/log/system.log authpriv.*;remoteauth.crit /var/log/secure.log lpr.info /var/log/lpr.log mail.* /var/log/mail.log ftp.* /var/log/ftp.log netinfo.err /var/log/netinfo.log install.* /var/log/install.log install.* @127.0.0.1:32376 *.emerg * apl$ logger -p lpr.info try this apl$ tail -1 /var/log/system.log Dec 12 08:40:46 localhost apl: try this apl$ tail -1 /var/log/lpr.log Dec 12 08:40:46 localhost apl: try this
See also Log Level
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-03-19 Tony Lawrence
The only thing I'd rather own than Windows is English. Then I'd be able to charge you an upgrade fee every time I add new letters like N and T. (Scott McNealy)