New `log stream` not working correctly with non-TTY STDOUT

Originator:kuehn.karl
Number:rdar://30397486 Date Originated:2/7/2017
Status:Duplicate: 27382661 Resolved:8/3/2017
Product:macOS + SDK Product Version:10.12.2 (16C60b)
Classification:Other bug Reproducible:always
 
Summary:
Starting with 10.12 Sierra much of the logging that used to appear in in the `/var/log/system.log`, or through `syslog`, is now only available through the `log` command. However, if STDOUT from `log` is anything other than a TTY I am not reliably getting data (possibly buffering?), making it unusable for following low-occurrence events. If I choose a high enough volume stream then it seems to work.

Steps to Reproduce:
1. Open three terminal windows: A, B, and C
2. In A and B run:
  A: `log stream --predicate 'eventMessage CONTAINS "elephants love peanutbutter"'`
  B: `log stream --predicate 'eventMessage CONTAINS "elephants love peanutbutter"'  | tee /dev/null`
3. In window C repeatedly run `syslog -l error -s 'elephants love peanutbutter'` while watching A and B.

Expected Results:
I would expect to see the same messages appear in A and B at about the same time (within a second is fine).

Actual Results:
Window A gets the messages immediately, while B either never gets them, or takes a long time to get a clump.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!