How to one start a process and monitor its syslog messages

logs

I would like to start a process and monitor its LOG_DEBUG syslog messages.

I know that I can change the filter of an already running process with syslog -c process (and then monitor its messages with syslog -w -k Sender process), but that requires the process already to be running and furthermore fills up logfiles with messages that I only need temporarily.

Is my only option to change the running configuration with syslog -config, then later restore the configuration once I have read the messages I want? Surely there is a "better" way.

Best Answer

Using the tail command in Terminal.app will follow a log file and print out in real time whats being written to just that log file.

tail -f /path/to/your/log/file.log

If your process has a common name that shows in every log file, like com.my.process you can tail the file and grep out for that keyword/process.

tail -f /var/log/system.log | grep "com.my.process"

tail command