Re: write to the console
Re: write to the console
- Subject: Re: write to the console
- From: ryan <email@hidden>
- Date: Wed, 23 Apr 2003 19:28:44 -0700
Someone else said it, and I will say it again, if you want stuff to go to
the console (you're a daemon for example) you should use 'syslog' facility.
Man syslog will tell you what you want to know.
-ryan
On 4/23/03 11:47 AM, "Chris Kane" <email@hidden> wrote:
>
NSLog() and fprintf(stderr, ...) are both sending output to the same
>
place, the stderr file of your process. When you run in a shell in a
>
Terminal window, this output goes to the shell which spews it on to
>
Terminal. (Well, that's somewhat simplified...) When you run, say, an
>
app by double-click, it's stderr is redirected by "Finder" (it's
>
perhaps simplest to think of Finder running the program, though that's
>
not correct) as it is started, to point to /var/tmp/console.log (and
>
again, this is not actually what is going on, but it's a much
>
easier-to-understand explanation).
>
>
Look at freopen() in the stdio subsystem (see the man page), as a
>
reasonable way to point your stderr at /var/tmp/console.log. Of
>
course, it is always possible that the OS may change the name of that
>
file in the future or put it somewhere else. Using freopen you can
>
point stderr at whatever file you like, it wouldn't have to be the
>
console log. Remember to use an append-without-truncation option, or
>
you'll be blowing away the file when you run your tool.
>
>
You may only want to redirect your stderr when it is going to a
>
Terminal or remote-logged-in-shell or similar. The simplest way to
>
detect this is to use the often-overlooked function isatty() (again,
>
see the man page) with STDERR_FILENO as the argument (<unistd.h>).
>
>
>
Chris Kane
>
Cocoa Frameworks, Apple
>
>
>
On Tuesday, April 22, 2003, at 23:40, Lloyd Dupont wrote:
>
>
> well, I'm testing with a simple tool.
>
> when I invoke it from the terminal NSLog() write in my terminal, but
>
> there is no output in the system console.
>
> I tried fprintf(stderr, ...); too, but it doesn't work either ...
>
>
>
>
>
> On Wednesday, April 23, 2003, at 04:34 PM, email@hidden wrote:
>
>
>
>> NSLog() is what I use
>
>>
>
>> On Wed, 23 Apr 2003 16:19:34 +1000, Lloyd Dupont wrote:
>
>>
>
>>>
>
>>> how to write to the console ?
>
>>> _______________________________________________
>
>>> cocoa-dev mailing list | email@hidden
>
>>> Help/Unsubscribe/Archives:
>
>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
>>> Do not post admin requests to the list. They will be ignored.
>
>>
>
>> __________________________________________________________
>
>> Get your FREE personalized e-mail at http://www.canada.com
>
> _______________________________________________
>
> cocoa-dev mailing list | email@hidden
>
> Help/Unsubscribe/Archives:
>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
> Do not post admin requests to the list. They will be ignored.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.