Re: NSTask(syslog)->NSPipe->NSFileHandle->readInBackgroundAndNotify buffers
Re: NSTask(syslog)->NSPipe->NSFileHandle->readInBackgroundAndNotify buffers
- Subject: Re: NSTask(syslog)->NSPipe->NSFileHandle->readInBackgroundAndNotify buffers
- From: Jason Bobier <email@hidden>
- Date: Wed, 11 Jun 2008 17:22:04 -0400
Hey Ken,
I was originally going to use the ASL api, but it seems to require
polling. Looking through the asl code, I noticed that the syslog
command didn't poll on Leopard and between that and the different
ASL_KEY_TIME formats on Tiger and Leopard, I decided to use the
syslog -w 5000 -F raw -u -k mykey
command and just parse the output. Polling the syslog database seems
rather horrendous even if I was able to filter out the previously
received entries (which doesn't seem possible because Tiger's
ASL_KEY_TIME isn't comparable and ASL_KEY_MSG_ID only appears in
Leopard).
Any other thoughts?
Jason
PS, I read the Domain of the Bored ASL stuff before I started and it
saved me countless headaches. :-)
On Jun 11, 2008, at 5:05 PM, Ken Thomases wrote:
On Jun 11, 2008, at 3:10 PM, Jason Bobier wrote:
The issue that I'm having is that I'm using NSTask to create a
syslog process with the -w option to continually parse specific
syslog entries. The problem is that if there are too few entries, I
never receive the notification.
I understand that along the way, something is buffering the data.
How do I turn that off?
I believe that this is out of the control of your Cocoa process.
It's under the control of the child syslog process. It might be
changing its behavior based on whether its output is going to a tty
device, but I'm not sure.
You should consider using the ASL (Apple System Log) API, instead.
It's Apple's more modern replacement for syslog. For backward
compatibility, I believe it's hooked into syslogd, but ASL is the
"native" logging facility. There's a great series of blog posts
about ASL here: <http://boredzo.org/blog/archives/2008-01-19/next-week-apple-system-logger
>.
Good luck,
Ken
_______________________________________________
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