Show logs on macOS(10.12 Sierra or later)

Overview

Use `log`.

Streaming (like tail command)

`log stream`

Find from past log

`log show`

See `man log` for detail.

Example

cron

$ log stream --info --predicate 'process == "cron"'
$ log show --info --predicate 'process == "cron"' --start '2017-05-25'

postfix

$ log stream --info --predicate '(process == "smtp") || (process == "smtpd")'
$ log show --info --predicate '(process == "smtp") || (process == "smtpd")' --start '2017-05-25'

If you doesn't know process name to specify

$ log show --info --start '2017-11-08' | grep 'xxx'

and guess process name.

Restart services installed with MacPorts

You can restart services installed with MacPorts using `port reload <portname>`.

$ port help load
...
If you want to restart a daemon, you can use port reload, which is a convenience wrapper around port unload followed by a short delay and port load.
...

Example

Apache

$ sudo port reload apache2

MySQL

$ sudo port reload mysql56-server