os_log repeating log entry multiple times

445 views Asked by At

Using Unified Logging, I'm getting multiple copies of each log entry (23 to be exact). I'm wondering what I might be doing wrong.

I'm using Swift 4.1, Xcode 9.4.1, Console Version 1.0 (2.0.52), and building an iOS 11.0 app.

The relevant code looks like:

import os.log
...
// property
let log = OSLog(subsystem: Constants.subsystem, category: Constants.category)

override func viewDidLoad() {
    super.viewDidLoad()
    os_log("Useless message...", log: log, type: .debug)
}

And, in the Console (only showing the Message column), I get:

Console Output

Subsystem, Category, Time, and Process values are identical for every entry.

And, the output only shows once in Xcode's console window.

What silly thing have I done now? (Or, is this a bug?)


Update: I set a breakpoint at the log statement to test. It's only hit once, but as soon as it executes, the 23 entries show in the Console.

Update 2: added UUID to log for test: same result: UUID was the same in all 23 entries.

os_log("Useless message... %@", log: log, type: .debug, String(describing: UUID()))

Results: Console Output with UUID Added

Update 3: Fixed...
Cleaned the project, deleted derived data, erased the content in the simulator - all of which I'd done multiple times before.

This time, though, I also shut down, then restarted Xcode - and now it's working fine! Weirdness!

0

There are 0 answers