Logs in iphone adhoc app

269 views
Skip to first unread message

dqueffeulouatw

unread,
Aug 9, 2012, 9:41:50 AM8/9/12
to cocoalu...@googlegroups.com
Hi,

I'm using cocoalumberjack to log within XCode for an iphone application. It works well.

Now I would like to get logs within an AdHoc application (not started by XCode) in the iphone console but I got nothing. I'm talking about the console view from the organizer window when the device is connected to the Mac.

I'm wondering if I have something special to do to get my logs or is it just possible ? I mean NSLog logs in the iphone console even for AdHoc app so I expected Lumberjack to do the same.

Any idea ?

thanks

Robbie Hanson

unread,
Aug 9, 2012, 2:46:58 PM8/9/12
to cocoalu...@googlegroups.com
You're running into a limitation with either iOS or perhaps Xcode. There's a way around, as I'll explain.

What you see it the console view (within Xcode's organizer window) comes from the Apple System Logger (ASL for short). However, as you noticed this log seems rather short. This is either because iOS itself keeps it's logging database very small, or Xcode only fetches and displays a very limited history.

Quick side note:

What does NSLog do?  It does two things. First it sends your log message to the Apple System Logger. This is essentially a daemon process that takes log entries and writes them to a system database. But, this doesn't actually display anything on screen. So then NSLog does the usual writing to stderr (aka the TTY). And it's this step that causes it to be written to screen, where it appears in the Xcode console.

With Lumberjack, things are a bit more flexible and transparent. Try disabling the TTY logger in your setup, but keep the ASL logger. You'll notice you still see your log statements in the console view via Xcode's organizer. But you won't see anything in Xcode's console while debugging. Now try the reverse. Enable TTY, but disable ASL. Now you'll see output while debugging in Xcode. But your logs will be absent from system log in organizer.
Long story short, there's no easy way around the ASL limitation imposed by Apple. So instead, just use a file logger. You have complete control over your logging history this way. And whenever you need, you can just grab the log files from the device or simulator and inspect them.

Let me know if this helps.

-Robbie Hanson

--
You received this message because you are subscribed to the Google Groups "CocoaLumberjack" group.
To post to this group, send email to cocoalu...@googlegroups.com.
To unsubscribe from this group, send email to cocoalumberja...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/cocoalumberjack/-/KIAMeLAjdnIJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

dqueffeulouatw

unread,
Aug 10, 2012, 8:17:24 AM8/10/12
to cocoalu...@googlegroups.com
Hi, thanks for reply

actually I've just discovered a bug on my side that set the level to ERROR while my expected log level was VERBOSE. I also updated the Lumberjack classes so now it works also in a AdHoc app with the organizer console.
I don't need currently to log in a file because I have to check mainly the start of the application with APNS registration, but I'm wondering if I create a log file, how to retrieve it on the Mac ? I don't know how to do that. I'll check your documentation by the way.
Reply all
Reply to author
Forward
0 new messages