Questions on syslog on macOS get no answers these days, the reason apparently being that 'it just doesn't work'.

Still, I would like to try one more time.

Is there a way that a syslog opened with

openlog ('apns', 'ndelay', 'mail');

to work on macOS Mojave?


No, the old way of logging is gone. The API to write to the new unified log are published.

There are quite a few WWDC sessions covering this as well as hundreds of blog posts with specifics. Depending on what specifically you are trying to do, the unified log can be a quick patch and sometimes be much better than when each log went to a different file.

To address your specific code, you would create an object instead of calling openlog function.

Then it’s pretty equivalent to inject your values into the system logging stream. From the command line shell, you can still call logger and nothing has changed. How you compile or interpret your code will govern which API you call, but it’s totally allowed to log still in 2020 on macOS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .