Re: Logging Mechanisms in Cocoa
Re: Logging Mechanisms in Cocoa
- Subject: Re: Logging Mechanisms in Cocoa
- From: Jens Alfke <email@hidden>
- Date: Sun, 10 Feb 2008 19:57:41 -0800
On 10 Feb '08, at 5:42 PM, Timothy Reaves wrote:
Not sure you've ever used NSLog() Jens.
Heh. I spent seven years writing Cocoa apps and frameworks at Apple.
By default, in a running application, it does indeed send to the
system log file, not just stdout or stderr.
It's complicated. In 10.4 and earlier, NSLog literally did just write
to stderr. When the system launched a new application, it connected
stderr (and stdout) to the file "console.log". So the effect of NSLog
was normally to write to console.log. (Unless you launched it from
Xcode or a shell.)
In Leopard, there is no more console.log. Instead, NSLog calls ASL.
This writes to the ASL database and system.log. (Stderr output gets
caught by launchd and echoed to ASL, though in kind of an ugly form.)
And a database is for "structured, queryable data". Whereas a log
file can be used for that, one in which other apps are dumping non-
structured data is just going to pollute the issue.
Not sure if you've ever used ASL, Tim. It has an honest-to-god
structured data store, not a text file. And there are APIs to query
it. It does echo a textual message to system.log, as a side effect,
for backwards compatibility.
How about you read the man page for asl(3) before we resume this fun
discussion?
—Jens_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden