Re: Cocoa and NSLog
Re: Cocoa and NSLog
- Subject: Re: Cocoa and NSLog
- From: Tommy Nordgren <email@hidden>
- Date: Fri, 14 Nov 2008 21:42:20 +0100
On 10 nov 2008, at 07.16, Marcus wrote:
9 nov 2008 kl. 23.03 skrev Tommy Nordgren:
Is it possible to open an Additional file for use by logging in Cocoa
(I want it to contain ONLY the info logged from my App)
You can do that by just redirect standard error to a file. Since
each process has their own set of file descriptors it will only
affect your application.
int fd = creat ("/Users/marcus/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");
Marcus
The specified method don't work. The default console log don't get a
copy this way.
A similar methods works if I forks, and pipes standard error into the
tee command.
I had really hoped there would be a method to set up the standard
error fd to
echo it's data to multiple file descriptors in my process.
----------------------------------
Skinheads are so tired of immigration, that they are going to move to
a country that don't accept immigrants!
Tommy Nordgren
email@hidden
_______________________________________________
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