Wade Tregaskis
Wade Tregaskis

Reputation: 2020

How to hide OSLogs from Xcode's console

Is there a way to filter out or simply disable OSLogs within Xcode (or more broadly)?

I can see that Xcode is going out of its way to integrate the OSLogs into its console, as opposed to them being just part of stdout/stderr from my process, because they don't show up when I run my executable in Terminal. But I cannot find any setting or toggle in Xcode that will stop it being "helpful" in this manner.

My Xcode console is swamped by URLSession et al log spam, about things that are not of any interest to me. As a result I can't use the Xcode console to see my own logging and program output.

As these logs originate in Apple's libraries, I cannot simply disable them at their source (the OSLog mechanism has no official way to control log output from in-process, other than not using OSLog - i.e. no 'logLevel' or similar I can set from my app).

I'm fine with any solution that also disables the OSLog output system-wide.

Note: none of the OSLog system settings, via e.g. the log CLI, help here since those only let you disable 'debug'- and 'info'-level logs, but URLSession et al log everything at 'error' level.

Upvotes: 1

Views: 1050

Answers (2)

Claus Jørgensen
Claus Jørgensen

Reputation: 26351

In Xcode 15 you can right-click and filter based on a number of parameters, such as the subsystem.

This is the only option available besides from disabling unified logging completely (which is not recommended)

Upvotes: 3

ud-ay
ud-ay

Reputation: 1

Create a new environmental variable with the name "OS_ACTIVITY_MODE" and in the value section enter "disable".

Upvotes: -2

Related Questions