Questions tagged [nslog]

Logs an error message to the Apple System Log facility.

The message consists of a timestamp and the process ID prefixed to the string you pass in. You compose this string with a format string and one or more arguments to be inserted into the string. The format specification allowed by this function is that which is understood by NSString’s formatting capabilities.

Displaying log messages in the system console while running your application is one of the oldest debugging mechanisms available. Using logging, you can generate a transcript describing the operations being performed by your application that you can review long after your application has finished running. Also, while your application is running, you can observe log messages being generated and written to the console as the events in your app they describe are taking place. As a developer, you are in complete control of the text and information displayed in the console by NSLog. Logging can reveal even the toughest to find problems in an app.

Here is an example of what a call to NSLog looks like:

NSString *message = @"test message";

NSLog( @"Here is a test message: '%@'", message );

Console:

Here is a test message: 'test message'

Reference:

Basic debugging with the NSLog function and the DEBUG preprocessor macro

667 questions
4
votes
2 answers

How Do I Log UIControlEvents?

I am trying to figure out how to log the UIControlEvents so that I can see exactly which ones I want to add to my UIButton. I can't seem to figure it out. Here is what I've tried so far: [button addTarget:self…
daveMac
  • 3,041
  • 3
  • 34
  • 59
4
votes
1 answer

Maximum size a NSLog can print

I was trying to print an array of dictionaries. The dictionary contains 300 keys and their values. There are about more than 6000 dictionaries in the array. But NSLog could print the array when the number of dictionaries in it were less than 3300.…
triandicAnt
  • 1,328
  • 2
  • 15
  • 40
4
votes
1 answer

Is NSLog have any affect on application performance?

Hi i have enormous calculation going on in my application as i have NSLog statement called at-lest 2000 times its a Big application of 11 MB. I am thinking to Remove this From my application so as to improve the performance. M i thinking in a right…
Vinay Chopra
  • 593
  • 3
  • 17
4
votes
2 answers

NSLog 10b meaning?

Whenever I use NSLog(), it always shows this mysterious "10b" next to the process ID. I know that this is tied somehow to the thread where the NSLog() call was made, but what exactly does it mean? When I try NSLog() from a different thread in the…
RJ
4
votes
1 answer

unknown log wx= wy= rx= ry= ios

Basically i am using calayer in a scrollview from the apple tiles example. I seem to get this odd output to to the consol(Target output). the reason i say its odd is because it looks like the log you get when you print variables out from a break…
abe
  • 4,046
  • 6
  • 29
  • 33
3
votes
1 answer

NSLog vs. Xcode breakpoint logging and creating log files

Would you rather recommend using NSLog or the logging feature provided by Xcode for breakpoints for debugging? Is there any advantage of using NSLog? For apps which are running on customer devices: Is there a easy way to log the NSLog or equivalent…
AlexR
  • 5,514
  • 9
  • 75
  • 130
3
votes
2 answers

How do I get a property of an object in an array of those objects in Objective C?

I have an array of custom objects, but I can't NSLog the property of an individual object in that array because you can store any objects in an array. How would I go about doing this?
TomLisankie
  • 3,785
  • 7
  • 28
  • 32
3
votes
1 answer

How to Disable NSLog inside Library or Framework? e.g. Admob Library

Admob and iAd are alway print log when the banner are not available. is it possible to disable it?
RAGOpoR
  • 8,118
  • 19
  • 64
  • 97
3
votes
3 answers

NSLog import and library

I can't believe how much trouble I am having finding this: I want to use NSLog() what do I have to #import and what library do I link to? thanks in advance, Jay
jbww
  • 735
  • 2
  • 12
  • 27
3
votes
2 answers

Creating multiple log files in iPhone app

I want to create two log files in my iPhone application. If I redirect the NSLog output to a file using freopen(), then all the log statements will go into one mentioned files.But I want to put some log statements into one file while some into…
Anshul
  • 234
  • 2
  • 16
3
votes
1 answer

same Int has different values in Swift, mysterious riddle

with this code : let rand : Int = Int(arc4random()) NSLog("rand = %d %i %@ \(rand)",rand,rand,String(rand)) I get : rand = -1954814774 -1954814774 2340152522 2340152522 why all 4 values are not the same ?
Gogo123
  • 655
  • 1
  • 4
  • 11
3
votes
4 answers

NSMutableArray's count method causes a bad access error?

I see a few similar questions, but no simple answers. I'm just playing around with NSMutableArray's to get a feel for them before I actually use them in my real project. For some reason, it's giving me an EXC_BAD_ACCESS error when I try to call…
TNTisCOOL
  • 125
  • 1
  • 9
3
votes
2 answers

NSLog Timestamps in Xcode Organizer's Console Don't Show Milliseconds

I am using NSLog to record logs in an iPhone application. In Xcode when I execute my iPhone application with "Run -> Console," I get timestamps in the following format: "2011-06-06 18:34:58.189". When I view the console through the Xcode…
DuneBug
  • 1,543
  • 4
  • 15
  • 28
3
votes
3 answers

redefine NSLog in Xcode

I Have a question about Xcode and Objective-C. I want to make this simple action in Xcode: If I type this : NSLog(@"something else"); I want Xcode to write (or execute after compile): NSLog(@"[%@] something else", NSStringFromClass([self…
Pixman
  • 599
  • 6
  • 17
3
votes
2 answers

Getting object name in Objective-c

suppose i have a class Foo and an instance of this class myFoo: Foo *myFoo; is there any method "dispalyFooObjectName" that can display the name of the object, for exmample : NSLog(@"i was called from %s", [myFoo dispalyFooObjectName]); and the…
tarek
  • 33
  • 1
  • 3