os_log: Unexpected value for integer in Console.app and in `log stream`

Originator:volodymyr.gorlov
Number:rdar://28574572 Date Originated:01-Oct-2016 01:22 AM
Status:Open Resolved:
Product:macOS SDK Product Version:
Classification: Reproducible:
 
Summary:
os_log incorrectly shows integers when even number of arguments (args: CVarArg) is used.

Steps to Reproduce:

Example code:
----------------------------------------------------------

import Cocoa
import os.log

class ViewController: NSViewController {

   static let log = OSLog(subsystem: "ua.com.wavelabs.OSLog-Demo", category: "UI")
   typealias SelfClass = ViewController

   override func viewDidLoad() {
      super.viewDidLoad()
      os_log("View loaded: %d", log: SelfClass.log, 1)
      os_log("View loaded: %d => %d", log: SelfClass.log, 1, 2)
      os_log("View loaded: %d => %d => %d", log: SelfClass.log, 1, 2, 3)
      os_log("View loaded: %d => %d => %d => %d", log: SelfClass.log, 1, 2, 3, 4)
      os_log("View loaded: %d => %d => %d => %d => %d", log: SelfClass.log, 1, 2, 3, 4, 5)

   }
}

----------------------------------------------------------

Expected Results:
Expected output in Xcode (Debug Area Console), Terminal (`log stream`) and Console.app:

View loaded: 1
View loaded: 1 => 2
View loaded: 1 => 2 => 3
View loaded: 1 => 2 => 3 => 4
View loaded: 1 => 2 => 3 => 4 => 5

Actual Results:
Output in Xcode (Debug Area Console):

View loaded: 1
View loaded: 1 => 2
View loaded: 1 => 2 => 3
View loaded: 1 => 2 => 3 => 4
View loaded: 1 => 2 => 3 => 4 => 5

Output in Terminal (`log stream`) and Console.app:

View loaded: 1
View loaded: 1 => 1718550530
View loaded: 1 => 2 => 3
View loaded: 1 => 2 => 3 => 1718550532
View loaded: 1 => 2 => 3 => 4 => 5

Version:
Version 8.0 (8A218a)
macOS: 10.12 (16A323)
Swift: Apple Swift version 3.0 (swiftlang-800.0.46.2 clang-800.0.38)

Comments

Seems working as expected in macOS 10.12.6 (16G29), Xcode 8.3.3 (8E3004b) or Xcode 9.0 beta 4 (9M189t).

By volodymyr.gorlov at Aug. 7, 2017, 6:37 p.m. (reply...)

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!