Write to Mac OS X Console logs from shell script or command line [closed] Write to Mac OS X Console logs from shell script or command line [closed] shell shell

Write to Mac OS X Console logs from shell script or command line [closed]


syslog -s -l error "message to send"

will log the message as something like

May 29 17:15:09 hostname syslog[22316]: message to send

You can customize things by using -k, which expects a list of alternating keys and values, for example

syslog -s -k Facility com.apple.console \             Level Error \             Sender MyScript \             Message "script says hello"

would produce

May 29 17:22:21 hostname MyScript[22343]: script says hello

(setting the Facility to com.apple.console makes it a "console" message, equivalent to stdout output from a double-clicked bundled application, and retrievable using syslog -C)


May be you should try the syslog command with -s option? See man syslog for details.
For example sudo syslog -s o.O