title: How do I display this Log message in the Debug area using Xcode9?
body: <p><a href="https://stackoverflow.com/a/25951564/2348597">This</a> looked promising but doesn't seem like a duplicate question as it addresses issues in Swift. </p>
  
  <hr>
  
  <p>I am finalising an existing Objective C project but <code>NSLog</code> disappeared when I updated to Xcode 9. So I'm looking for some setting in Xcode that lets me continue using <code>NSLog</code> to fine tune the project. </p>
  
  <p>Basic debugging using logging for Swift and Objective-C apps appears to have changed in Xcode 9 as <code>NSLog</code> messages no longer appear in the Debug area. The window where <strong>DEBUG=1</strong> is set no longer looks like <a href="https://developer.apple.com/library/content/technotes/tn2347/_index.html#//apple_ref/doc/uid/DTS40014516-CH1-TNTAGN1" rel="nofollow noreferrer">Figure 2 The DEBUG preprocessor macro setting in an Xcode project.</a> </p>
  
  <p>As an example, I want to display this string message in the Debug area using Xcode9.</p>
  
  <pre><code>    NSString *outputData = @"This should show in Debug area";
      NSLog( @"text: %@", outputData );
  </code></pre>
  
  <p>I studied the latest documentation <a href="https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/debugging_tools.html#//apple_ref/doc/uid/TP40015022-CH8-SW1" rel="nofollow noreferrer">here</a> or <a href="https://developer.apple.com/library/content/technotes/tn2347/_index.html#//apple_ref/doc/uid/DTS40014516-CH1-TNTAGN1" rel="nofollow noreferrer">here</a> but so far that has not helped. It may also be worth noting that previously the Debug area would open automatically when I ran the project. Since installing <code>Xcode9</code> it no longer does that.</p>
  
  <p>Hopefully the extra information provided in the edits <em>below</em> will suggest to someone where I have yet to look. Thanks.</p>
  
  <hr>
  
  <p>EDIT 1</p>
  
  <p>In the Console area - i.e. the bottom right part of the Debug area - I had <em>All Output</em> selected. So I tried using <em>Debugger output</em> and <em>Target output</em> but there was still no log.</p>
  
  <p>I added these statements in the <code>Prefix.pch</code> file </p>
  
  <pre><code>#ifndef DEBUG
  #define NSLog(...) /* suppress NSLog when in release mode 
  #endif
  </code></pre>
  
  <p>When I ran the code the following appeared in the Issue Navigator.</p>
  
  <pre><code>    Unused variable 'outputData'
  </code></pre>
  
  <hr>
  
  <p>EDIT 2</p>
  
  <p>There seems to be a different place to set <strong>DEBUG=1</strong> in Xcode9 (see <em>below</em>).</p>
  
  <p>I inserted a DEBUG macro into the .pch file using the examples suggested in several SO posts <a href="https://stackoverflow.com/a/302246/2348597">here</a>, <a href="https://stackoverflow.com/a/300783/2348597">here</a>, <a href="https://stackoverflow.com/a/17206296/2348597">here</a> (all quite old) and <a href="https://stackoverflow.com/a/16002178/2348597">even here</a> (<em>making sure to change MyLog back to NSLog</em>). And in each case I was able to report the same issue in the Issue navigator but never in the Debug console. A similar problem (with <code>Xcode5</code>) was solved <a href="https://stackoverflow.com/q/20183006/2348597">here</a> by copying over the files into a new project but I want to avoid this. </p>
  
  <p>My app which was almost finished has so far not had to deal with any of the complex issues that unified logging seeks to address. But I watched the <a href="http://devstreaming.apple.com/videos/wwdc/2016/721wh2etddp4ghxhpcg/721/721_unified_logging_and_activity_tracing.pdf" rel="nofollow noreferrer">2016 WWDC video</a> on unified logging and read through its slide show files searching for an example of how to use the appropriate API to do something as basic - print <code>NSLog</code> live to the console area - the way I did before installing <code>Xcode9.</code> This may be the wrong approach. But I can’t think of a better way to proceed.</p>
  
  <hr>
  
  <p>EDIT 3 </p>
  
  <p>It's worth noting that when I created a new Objective C project using Xcode9 and ran the above code, the string message appeared in the Console area. </p>
  
  <p>In other words, using Xcode9 the new logging API <em>does</em> work with <code>NSLog,</code> but only for a new project and not for one created using an earlier version of Xcode.</p>
  
  <hr>
  
  <p><strong>Enable DEBUG preprocessor macro</strong></p>
  
  <p><a href="https://i.stack.imgur.com/v0VdD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v0VdD.png" alt="The DEBUG preprocessor macro setting in an Xcode project."></a></p>