763

When using the Xcode 8+ and creating a new blank project, the following logs appear when running the application:

2016-06-13 16:33:34.406093 TestiOS10[8209:100611] bundleid: com.appc.TestiOS10, enable_level: 0, persist_level: 0, propagate_with_activity: 0
2016-06-13 16:33:34.406323 TestiOS10[8209:100607] Created DB, header sequence number = 248
2016-06-13 16:33:34.409564 TestiOS10[8209:100611] subsystem: com.apple.UIKit, category: HIDEvents, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
2016-06-13 16:33:34.504117 TestiOS10[8209:100607] Created DB, header sequence number = 248
2016-06-13 16:33:34.548023 TestiOS10[8209:100607] subsystem: com.apple.BaseBoard, category: MachPort, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0
2016-06-13 16:33:34.568458 TestiOS10[8209:100608] subsystem: com.apple.FrontBoard, category: Common, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 0, privacy_setting: 0

Maybe someone already found a configuration for this to handle?

Hans Knöchel
  • 11,422
  • 8
  • 28
  • 49
  • 1
    Seems to just be debug logging information left over from development. Investigating... – JAL Jun 14 '16 at 01:42
  • did u turn off the dynamic linker api usage in xcode ? – Teja Nandamuri Jun 21 '16 at 18:11
  • Not working for me in Xcode 8 seems like, this solution works for only Xcode 8 beta. – Badal Shah Sep 25 '16 at 05:42
  • I had this issue with Xcode 8.2.1 on El Capitan. Upgrading to macOS Sierra fixed the problem. – hwaxxer Jan 26 '17 at 10:25
  • 2
    I'm still seeing the issue on Xcode 9.3, I've submitted Apple Bug #34767176 (Xcode 9 Displays System Framework Debug Print Statements), which is a duplicate of the open bug #32256894 Please submit a duplicate of the bug to Apple: https://bugreport.apple.com/web/ – Paul Solt May 08 '18 at 16:01
  • 1
    Check this article https://mightytechno.com/x-code-disable-annoying-system-logs/ – Ishan Fernando Feb 16 '19 at 06:24
  • @IshanFernando that link is 404 but here’s a copy of it: https://medium.com/@ishanfx/x-code-disable-annoying-system-logs-855c6ae18c7c – Syclone0044 Oct 11 '20 at 05:29

14 Answers14

1614

Try this:

1 - From Xcode menu open: Product > Scheme > Edit Scheme

2 - On your Environment Variables set OS_ACTIVITY_MODE = disable

Screenshot

SwiftiSwift
  • 7,528
  • 9
  • 56
  • 96
iDevzilla
  • 15,382
  • 1
  • 16
  • 16
  • 25
    It also works on Xcode 8.0 release so I suggest it is the solution. – nadein Sep 14 '16 at 09:42
  • 2
    This is the best solution I have seen, I hope more people see this. This extra logging crap has been driving me crazy!! Cheers for solution!! – AdamM Sep 14 '16 at 10:04
  • 27
    For anyone wondering how to get to that screen, you need to go to Product > Scheme > Edit Scheme or Cmd + – chrishale Sep 14 '16 at 13:38
  • 52
    @iDevzilla, There's some issue with this solution, it removes some important stuff out of the log when using real device, like self logged data. Please overview it again, i'm not sure it's the most ideal solution. – Itai Spector Sep 15 '16 at 09:03
  • @ItaiSpector true, but you can create a different scheme to run on the device/simulator. So far this is the only solution I know that removes the useless log when running on the simulator. – iDevzilla Sep 15 '16 at 14:05
  • 123
    Unfortunately, this option hides all `NSLog`s from a real device for me... – Dmitry Isaev Sep 16 '16 at 12:20
  • 4
    This solution also hides some important logging in the simulator. For example, I missed the following warning "This app has crashed because it attempted to access privacy-sensitive data without a usage description." until I enabled again the OS_ACTIVITY_MODE – AirXygène Sep 22 '16 at 20:25
  • 1
    @AirXygène What about the values `release` or `stream` instead? See my answer below. – BaseZen Sep 22 '16 at 21:00
  • @BaseZen thanks for the suggestion, but I had no luck trying that. – AirXygène Sep 22 '16 at 21:24
  • 10
    The problem only resists in Simulator. Personally I don't believe it is a good idea to add the environment variable, because it also hides important logs like problems with Layout Constraints and among others the example @AirXygène gave. In simulator you can also hit "CMD + /" to open the console, it will give you the old-fashioned logs. Hopefully Apple will fix this issue in Xcode though, there is a lot of interest in this looking at the number of upvotes ;) – Bocaxica Oct 12 '16 at 10:48
  • But how to disable the same on a device? I mean the logs from a real iPhone or iPad shown in Window -> Devices menu? Very often, we need to see the logs of a distribution/production app installed on a device (non-debug mode). – Prabu Arumugam Oct 17 '16 at 15:42
  • No in 8.1 GM seed if we run on simulator then still logs system logs comes – Abhishek Thapliyal Oct 28 '16 at 12:18
  • I've tested here (I'm using Version 8.1 (8B62) ) now, not GM, and the flag is no longer necessary. – iDevzilla Oct 28 '16 at 17:01
  • 2
    @iDevzilla are you using macOS Sierra? I think the fix might require Xcode 8.1 *and* Sierra because I have removed the option and am still seeing the excessive logging when running Xcode 8.1. on El Capitan. – Geoff Hackworth Oct 31 '16 at 14:55
  • Yes. I'm using Sierra. Interesting that the OS changes this behavior. – iDevzilla Nov 01 '16 at 02:48
  • Does it also hide the auto layout errors or this is some strange phenomena that only happens at my customer's computer? He has auto layout error *and* a screen full of these warnings – Lucas van Dongen Nov 07 '16 at 22:55
  • In Sierra and Xcode 8.1 the logs have been removed. So it is better to remove this flags as it could interfear with thrown exceptions by the system while debugging – Marco Pappalardo Apr 28 '17 at 13:37
  • 7
    This solution will hide all NSLog starting with Xcode 9. To keep NSLog, replace `disable` with `default`. – Cœur Sep 27 '17 at 19:09
  • I was getting all sorts of logs that I did not want, tried this method which stops NSLog from working. Deleted the var and now NSLog is back and the extra logs that I didn't want have stopped too. Must have cleared something hanging around in xCode 9. Anyway, cheers :) – GeoffCoope Oct 17 '17 at 16:47
  • OS_ACTIVITY_MODE=disable caused problems with my packager when trying to run on device. but not at first. only after developing my app for another several hours. At that point I was getting a jsbundle error (essentially device wasn't talking to the packager). The fact that this turned up only later made it VERY difficult to realize this env variable was the issue. – roocell Oct 22 '17 at 14:21
  • I'm still seeing the issue on Xcode 9.3, I've submitted Apple Bug #34767176 (Xcode 9 Displays System Framework Debug Print Statements), which is a duplicate of the open bug #32256894 Please submit a duplicate of the bug to Apple: https://bugreport.apple.com/web/ – Paul Solt May 08 '18 at 16:02
  • This worked after I tried it for the second time, like another user pointed out in a comment from another answer. Weird. – Tuan Anh Vu Nov 28 '18 at 00:19
  • Note, that this breaks signposts on real devices: https://stackoverflow.com/a/57187309/2982854 – Tim Sep 24 '20 at 13:14
  • it's better to set it 'default' instead of 'disable', setting 'enable' will show each and every log, but disable will also disable every log (even useful logs from pods), so better use 'default' as it will only hide useless logs – Abhishek Maurya Oct 10 '20 at 18:55
  • I do not think that this a good answers. What is does is just hiding messages. The messages still remain but are not shown. Also constraints warning are hidden which may cause unpredictable / unwanted actions from the app.| IMHO a bad answer – Vincent Apr 03 '22 at 15:50
  • Work well for suppressing the **hundreds** of OS activity related message in the console. Thank you! Did not affect the **tens of thousands** of `CGSWindowShmemCreateWithPort failed on port 0` messages. *sad panda* – Eljay Apr 19 '23 at 16:12
392

Building on the original tweet from @rustyshelf, and illustrated answer from iDevzilla, here's a solution that silences the noise from the simulator without disabling NSLog output from the device.

  1. Under Product > Scheme > Edit Scheme... > Run (Debug), set the OS_ACTIVITY_MODE environment variable to ${DEBUG_ACTIVITY_MODE} so it looks like this:

enter image description here

  1. Go to your project build settings, and click + to add a User-Defined Setting named DEBUG_ACTIVITY_MODE. Expand this setting and Click the + next to Debug to add a platform-specific value. Select the dropdown and change it to "Any iOS Simulator". Then set its value to "disable" so it looks like this:

enter image description here

Elijah
  • 8,381
  • 2
  • 55
  • 49
cduhn
  • 17,818
  • 4
  • 49
  • 65
  • Doesn't work on Version 8.0 (8A218a). Scheme settings can be seen [here](http://i.imgur.com/28NUS6c.png) and build settings can be seen [here](http://i.imgur.com/tOUhLKq.png). – NSNoob Nov 02 '16 at 12:05
  • @the comment above, please try again, I use Xcode 8.0 (8A218a) too and it does work fine. – Rikco Nov 03 '16 at 10:18
  • @NSNoob, Select your target and check its Build Settings to make sure you're not overriding the DEBUG_ACTIVITY_MODE variable at that level. Also make sure you edited the correct scheme for the target that you're running. – cduhn Nov 04 '16 at 02:02
  • 7
    @NSNoob make sure you don't have a space in the env variable. – sbarow Nov 17 '16 at 22:38
  • 9
    Too bad this is not the accepted answer and too bad this answer is losing the up vote count. *Much* better answer IMHO since it only disabled OS_ACTIVITY_MODE for DEBUG builds on simulator. – Swany Nov 28 '16 at 22:38
  • 19
    This didn't work for me, and neither did the top-voted answer. Using Xcode 8.2.1 on OS X 10.11.6 El Capitan. But what did work was a combination of this answer and the one by BaseZen, using OS_ACTIVITY_DT_MODE instead of OS_ACTIVITY_MODE. (And unexpectedly for me at least both "NO" and "disable" turned off the rampant logging.) – RenniePet Mar 14 '17 at 20:58
  • 2
    @RenniePet, that's exactly what did it for me. Thanks! – Misha May 28 '17 at 17:41
  • 1
    I also had to use OS_ACTIVITY_DT_MODE instead of OS_ACTIVITY_MODE for it to work. Using XCode 8.3.3 on OSX Sierra 10.12.6 – keronsen Aug 16 '17 at 09:09
  • 16
    This solution will hide all NSLog starting with Xcode 9. To keep NSLog, replace `disable` with `default`. – Cœur Sep 27 '17 at 19:09
  • How to filter the noise now that I've had to go back and replace disable with default? I can see my NSLog statements in the console, but am getting all the noise again. – Alyoshak Nov 14 '18 at 17:22
  • 1
    For me this does disable NSLog output on the iOS simulator, I don't see this is different from simply using `disable` as the value. `default` also disables NSLog logs... – szx Nov 23 '18 at 07:52
102

OS_ACTIVITY_MODE didn't work for me (it may have been because I typo'd disable as disabled, but isn't that more natural?!?), or at least didn't prevent a great deal of messages. So here's the real deal with the environment variables.

https://llvm.org/svn/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

lldb_private::Error
PlatformDarwin::LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) {
  // Starting in Fall 2016 OSes, NSLog messages only get mirrored to stderr
  // if the OS_ACTIVITY_DT_MODE environment variable is set.  (It doesn't
  // require any specific value; rather, it just needs to exist).
  // We will set it here as long as the IDE_DISABLED_OS_ACTIVITY_DT_MODE flag
  // is not set.  Xcode makes use of IDE_DISABLED_OS_ACTIVITY_DT_MODE to tell
  // LLDB *not* to muck with the OS_ACTIVITY_DT_MODE flag when they
  // specifically want it unset.
  const char *disable_env_var = "IDE_DISABLED_OS_ACTIVITY_DT_MODE";
  auto &env_vars = launch_info.GetEnvironmentEntries();
  if (!env_vars.ContainsEnvironmentVariable(disable_env_var)) {
    // We want to make sure that OS_ACTIVITY_DT_MODE is set so that
    // we get os_log and NSLog messages mirrored to the target process
    // stderr.
    if (!env_vars.ContainsEnvironmentVariable("OS_ACTIVITY_DT_MODE"))
      env_vars.AppendArgument(llvm::StringRef("OS_ACTIVITY_DT_MODE=enable"));
  }

  // Let our parent class do the real launching.
  return PlatformPOSIX::LaunchProcess(launch_info);
}

So setting OS_ACTIVITY_DT_MODE to "NO" in the environment variables (GUI method explained in Schemes screenshot in main answer) makes it work for me.

As far as NSLog being the dumping ground for system messages, errors, and your own debugging: a real logging approach is probably called for anyway, e.g. https://github.com/fpillet/NSLogger .

OR

Drink the new Kool-Aid: http://asciiwwdc.com/2016/sessions/721 https://developer.apple.com/videos/play/wwdc2016/721/ It's not surprising that there are some hitches after overhauling the entire logging API.

ADDENDUM

Anyway, NSLog is just a shim:

https://developer.apple.com/library/content/releasenotes/Miscellaneous/RN-Foundation-OSX10.12/

NSLog / CFLog

NSLog is now just a shim to os_log in most circumstances.

Only makes sense now to quote the source for the other env variable. Quite a disparate place, this time from Apple internals. Not sure why they are overlapping. [Incorrect comment about NSLog removed]

[Edited 22 Sep]: I wonder what "release" and "stream" do differently than "debug". Not enough source.

https://github.com/macosforge/libdispatch/blob/8e63547ea4e5abbfe55c0c3064181c4950a791d3/src/voucher.c

e = getenv("OS_ACTIVITY_MODE");
if (e) {
    if (strcmp(e, "release") == 0) {
        mode = voucher_activity_mode_release;
    } else if (strcmp(e, "debug") == 0) {
        mode = voucher_activity_mode_debug;
    } else if (strcmp(e, "stream") == 0) {
        mode = voucher_activity_mode_stream;
    } else if (strcmp(e, "disable") == 0) {
        mode = voucher_activity_mode_disable;
    }
}
BaseZen
  • 8,650
  • 3
  • 35
  • 47
65

A tweet had the answer for me - https://twitter.com/rustyshelf/status/775505191160328194

To stop the Xcode 8 iOS Simulator from logging like crazy, set an environment variable OS_ACTIVITY_MODE = disable in your debug scheme.

It worked.

Peter Smith
  • 1,150
  • 8
  • 11
  • 8
    As already said: The OS_ACTIVITY_MODE = disable deactivates all other logging with a NSLog. – dzensik Sep 27 '16 at 15:08
  • 6
    This solution will hide all NSLog starting with Xcode 9. To keep NSLog, replace `disable` with `default`. – Cœur Sep 27 '17 at 19:10
44

Please find the below steps.

  1. Select Product => Scheme => Edit Scheme or use shortcut : CMD + <
  2. Select the Run option from left side.
  3. On Environment Variables section, add the variable OS_ACTIVITY_MODE = disable

For more information please find the below GIF representation.

Edit Scheme

Ramkrishna Sharma
  • 6,961
  • 3
  • 42
  • 51
  • 4
    Wait....On the second run it worked. Kudos for Gif Video. The best answers are always on the bottom! – Sentry.co Mar 02 '17 at 18:16
  • 6
    This solution will hide all NSLog starting with Xcode 9. To keep NSLog, replace `disable` with `default`. – Cœur Sep 27 '17 at 19:11
  • 2
    @Cœur you are a saviour, Everyone was saying it to disable, but you gave me the best answers, Thanks a lot man. – Abhishek Maurya Jul 03 '20 at 07:49
35

This is still not fixed in Xcode Version 8.0 beta 2 (8S162m) for me and extra logs are also appearing in the Xcode console

** EDIT 8/1/16: This has been acknowledged in the release notes for Xcode 8 Beta 4 (8S188o) as an issues still persisting.

Known Issues in Xcode 8 beta 4 – IDE

Debugging

• Xcode Debug Console shows extra logging from system frameworks when debugging applications in the Simulator. (27331147, 26652255)

Presumably this will be resolved by the GM release. Until then patience and although not ideal but a workaround I'm using is below...

Similar to the previous answer I am having to:

  • prefix my print logs with some kind of special character (eg * or ^ or ! etc etc)

  • Then use the search box on the bottom right of the console pane to filter my console logs by inputing my chosen special character to get the console to display my print logs as intended

console

Community
  • 1
  • 1
Pez
  • 462
  • 4
  • 7
  • I can confirm that this logging issue is still present in beta 2 – benrudhart Jul 07 '16 at 08:50
  • Added a screenshot now I have enough privileges. I feel unlike the other answers, it is not necessary to have to launch the system wide logs when there is a work around directly within Xcode for those experiencing the same issue in Xcode console and just wanting to view what they are printing to the Xcode console. – Pez Jul 07 '16 at 17:49
  • Is there a way to be notified when a new version of Xcode beta (ie. email subscription)? Was still running beta 0 and didn't notice there have been updates until saw this post @benrudhart – SimplyLearning Jul 22 '16 at 14:06
  • 1
    @SimplyLearning you'll find this information all over twitter. But you might check out this official website from apple: http://developer.apple.com/news/ or their newsfeed to get updates when they publish them: http://developer.apple.com/news/rss/news.rss By the way: this still seems to be an issue in Xcode Beta 3. – benrudhart Jul 22 '16 at 14:10
  • 51
    Just got Xcode 8 GM, and the issue still persists. Very annoying!! – AdamM Sep 08 '16 at 12:15
  • 8
    Just downloaded Xcode Version 8.0 (8A218a) from App Store. The issue is still there. – Statik Sep 14 '16 at 05:58
  • 4
    Just ridiculous. Still there in Final MAS version. – Shai Mishali Sep 15 '16 at 17:32
  • This workaround is nice. But do take note, recently NSLogs are truncated by XCode if it is too long. – GeneCode Mar 14 '17 at 06:36
  • 1
    We use a tag-prefix for filtering. Some issues are: Multiple lines will only show the first one. When using lldb for debugging, you need to toggle the filtering. Really really sad that as of today, the console is extremely limited. We have an App for decent filtering, but we need to copy/paste from the console. How sad. – bauerMusic Dec 04 '18 at 08:53
23

My solution is to use the debugger command and/or Log Message in breakpoints.

enter image description here

And change the output of console from All Output to Debugger Output like

enter image description here

mrahmiao
  • 1,291
  • 1
  • 10
  • 22
14

Alright. There seems to be a lot of commotion about this one, so I'll give y'all a way to persist it without using that scheme trick. I'll address the iOS Simulator specifically, but this also might need to be applied for the TV Sim as well which is located in a different dir.

The problem that is causing all of this stuff are plists located within the Xcode directory. There is a process that gets launched called configd_sim when the Sim starts that reads the plists in and prints debugging information if the plists specify they should be logged.

The plists are located here:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Preferences/Logging/Subsystems

If you are playing around with a beta, take note that the dir will be different.

You will see numerous plists in this directory. Now, build and run your application and observe the logs. You are looking for the content immediately followed by the subsystem: part. It is the name immediately following this that represents the corresponding problematic plist.

enter image description here

From there, either modify the plist to knock out the debugging [Level] key/value which is a dictionary containing the "Enable" => "Default" key/value... or just simply delete the plist. Note, that you will need to be root to do either of these since they're located in the Xcode application.

the plutil -p command might be of use to you as well. i.e.

plutil -p /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/System/Library/Preferences/Logging/Subsystems/com.apple.BackBoardServices.fence.plist

This gave me one of the problematic plists which contained:

{ "DEFAULT-OPTIONS" => { "Level" => { "Enable" => "Default" }}}

Good luck :]

Sozin's Comet
  • 483
  • 5
  • 13
  • I zipped, then deleted in case I need to restore. – dandan78 Sep 21 '16 at 15:04
  • 1
    I found this was unable to silence a lot of networking code, probably because it's lacking a subsystem name: `2016-09-23 15:09:21.354686 ProductName[8823:191206][] tcp_connection_start 3 starting` – BaseZen Sep 23 '16 at 19:10
  • @BaseZen Unfortunately, I only addressed OPs question which did not contain any tcp logging issues. You can create a new SO post if you need help addressing this issue. – Sozin's Comet Sep 23 '16 at 21:27
13

This is related to a known issue with logging found in the Xcode 8 Beta Release Notes (also asked an engineer at WWDC).

When debugging WatchOS applications in the Watch simulator, the OS may produce an excessive amount of unhelpful logging. (26652255)

There is currently no workaround available, you must wait for a new version of Xcode.

EDIT 7/5/16: This is supposedly fixed as of Xcode 8 Beta 2:

Resolved in Xcode 8 beta 2 – IDE

Debugging

  • When debugging an app on the Simulator, logs are visible. (26457535)

Xcode 8 Beta 2 Release Notes

JAL
  • 41,701
  • 23
  • 172
  • 300
  • Thought that as well, but I am neither using an watchOS application nor an watchOS simulator. But it still might happen to other Sims as well. Putting on hold for now and see if a certain Xcode 8 Beta will fix it over the next weeks / months. – Hans Knöchel Jun 14 '16 at 02:53
  • @HansKnoechel neither am I but I can confirm that this issue occurs with any application. No "official" word from Apple besides the release notes and some discussion at WWDC. – JAL Jun 14 '16 at 02:54
  • thanks, same here! We should talk about that tomorrow during WWDC, hehe :-) – Hans Knöchel Jun 14 '16 at 05:11
  • Also happens for my iPhone 5s Simulator, probably all simulators. – SimplGy Jun 23 '16 at 16:59
  • I couldn't get access to the link in this answer, despite being signed in, but this link works: http://adcdownload.apple.com/WWDC_2016/Xcode_8_beta/Release_Notes_for_Xcode_8_beta.pdf – SimplGy Jun 23 '16 at 17:06
  • Is there a way to be notified when a new version of Xcode beta (ie. email subscription)? Was still running beta 0 and didn't notice there have been updates until saw this post @mrahmiao – SimplyLearning Jul 22 '16 at 14:07
  • @SimplyLearning New Xcode beta will be released with iOS beta – mrahmiao Jul 31 '16 at 12:41
  • Not fixed in b6, either, for any kind of target. – Rick Aug 31 '16 at 02:02
  • I'm getting this in 2021 – ScottyBlades Oct 22 '21 at 10:54
7

This is no longer an issue in xcode 8.1 (tested Version 8.1 beta (8T46g)). You can remove the OS_ACTIVITY_MODE environment variable from your scheme.

https://developer.apple.com/go/?id=xcode-8.1-beta-rn

Debugging

• Xcode Debug Console no longer shows extra logging from system frameworks when debugging applications in the Simulator. (26652255, 27331147)

mriddle89
  • 162
  • 2
  • 3
  • 23
    I'm still getting a lot of spurious logging in 8.1. Mostly weird socket and tcp connection stuff. Anyone else, or just me? – Jordan Smith Oct 26 '16 at 22:05
  • 3
    I've just downloaded Xcode 8.1 today (31/10/2016) and still seeing some debugging logging like this `[MC] Reading from private effective user settings.` from a blank new dummy project File > New > Project. – Zhang Oct 31 '16 at 13:23
6

In Xcode 10 the OS_ACTIVITY_MODE variable with disable (or default) value also turns off the NSLog no matter what.

So if you want to get rid of the console noise but not of your own logs, you could try the good old printf("") instead of the NSLog since it is not affected by the OS_ACTIVITY_MODE = disable.

But better check out the new os_log API here.

Jakub Truhlář
  • 20,070
  • 9
  • 74
  • 84
4

Please note that for iOS 14 Simulator, the OS_ACTIVITY_MODE=disable will not show any logs using the new Swift Logger. You will have to remove or enable it.

StackUnderflow
  • 2,403
  • 2
  • 21
  • 28
3

I read all solutions, nothing worked so far, I am using XCODE 12.5 at the time of writing this response, it's the most annoying thing to see in a debugger with such a heap/flood of unwanted messages.

The solution I did was a lot simpler than most complex ones out there, here is what I did to solve this annoying issue:

  1. No need to use any environment variables etc, otherwise using these as suggested by the previous posts would disable NSLOG output which isn't what you want in such case.

  2. I made sure that all my NSLOG would contain a String that I would monitor later on, example:

Previously I used to do:

NSLog(@"Hello World");

Now, I do:

NSLog(@"[Admin]: Hello World");

Whereas "[Admin]" is the name of my program (or whatever string you like other than [Admin]"

  1. (Optional Step) or (Easier), I wrote a function to channel (well; proxy) NSLog into another global function "Log" whereas all my logged would go to that function, and then the Log function would append the "[Admin]" string to the original logging string and also add logging-time and other items I needed etc (similar to WebLogic or any other JAVA logging), this ensure that all logs would follow one standard.

  2. ... Here is the million dollar nuclear weapon:

Now, go into your Debugger window, at the bottom you will see a "search" window whereas it says "Filter", enter your string (example; "[Admin]"), press ENTER, and job done.

This way, you will only see the lines you like to see,

enter image description here

Also useful when you like to filter out other components, example, for network communication I use more strings that I can filter later on.

In other words, the annoying lines of logs that has nothing to do with your app will always be there, but you choose not to see them using the above command which I hope solves the issue.

Hopefully a good day to all.

H

Heider Sati
  • 2,476
  • 26
  • 28
1

This solution has been working for me:

  1. Run the app in the simulator
  2. Open the system log ( + /)

This will dump out all of the debug data and also your NSLogs.

To filter just your NSLog statements:

  1. Prefix each with a symbol, for example: NSLog(@"^ Test Log")
  2. Filter the results using the search box on the top right, "^" in the case above

This is what you should get:

Screenshot of console

psobko
  • 1,548
  • 1
  • 14
  • 24