On 6/29/10 7:09 AM, "Tito Ciuro" <[email protected]> wrote:

[snip]

> I don't really like it, since this forces me to use NSLogOut() everywhere...
> which kinda sucks. Instead, is there a way to configure NSLog() so that it
> redirects to stdout instead of stderr?

Lifted from http://cocoaheads.byu.edu/wiki/different-nslog:

Redirected NSLog()

Occasionally, you may want to redirect your NSLog() output to a file so that
you can examine it more conveniently. NSLog() works by outputting messages
to STDERR, so all you need to do is redirect the STDERR stream to a file,
and you're good to go. The following code will redirect it to a file on your
desktop:

int fd = creat ("/Users/dave/Desktop/my_log", S_IRUSR | S_IWUSR | S_IRGRP |
S_IROTH);
close (STDERR_FILENO);
dup (fd);
close (fd);
NSLog(@"this will be written to my_log");
This will only affect NSLog() calls from your application.

Butch Anton
[email protected]



_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to