Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
591 views
in Technique[技术] by (71.8m points)

ios - is NSLog() stored on the device (iPhone etc)? If so, where?

Should all NSLog() calls be deleted in the final app for iTunes?

In my iOS app, I've got lots of NSLog() for debug. Should I conditionally code them out before uploading to iTunes?

This is for an app for: iPhone, iPod, iPad

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I'll answer the OP's question in the title about where the logs are stored on the device. NSLog() uses the ASL (Apple System Logger). Programmatically, you can only read the last 256 entries (which is what Xcode shows in the Organizer, for example).

However, if you want to access the full files, they are stored in:

/private/var/log/DiagnosticMessages

When you look into that directory (note: device must be Jailbroken), you'll find a long list of *.asl files.

I found a tool to parse those files, but I haven't tried it yet, so YMMV:

Parsing Apple System Log (ASL) files on iOS and OSX for Fun and Evidence (and a Python script to do it for you)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...