Re: Effectively fetching console messages
Re: Effectively fetching console messages
- Subject: Re: Effectively fetching console messages
- From: Martin Stoufer <email@hidden>
- Date: Fri, 28 Nov 2008 09:48:46 -0800
Couldn't you open a StreamReader object to the file itself (or perhaps
from the out end of an NSTask that has the filtering already in place)?
I'm thinking some type of grep with the appropriate expression. This
task could be left open and simply keep reading in a worker thread in
your app. If I am correct in what I see NSTask provides, reads will only
occur when new data is there in the pipe. At this point, your reading
thread would post messages when new content is ready to be processed.
Of course, if the log file rolls over, this will have to be caught and
handled properly in your code.
Good luck on this and let us know how things work out. This would be a
nice model to share with others.
-Martin
Luke the Hiesterman wrote:
[Resending to this this. Sorry for anybody who is reading it twice].
I have an app that wants to continually fetch console messages, much
like the Console app itself. The problem I'm having is that the act of
performing and asl_search every second, or even every 5 seconds makes
syslogd go nuts and performance goes out the window. I specify that my
search is only for messages in the time interval since my previous
search, so I wouldn't think this would be too terribly offensive a
task, but it seems that it is for one reason or another.
Is there a way I can setup to listen for new messages rather than
pinging asl_search continuously, or is there some other method to
getting the messages that would have better performance results?
Thanks for any tips.
Luke
_______________________________________________
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
_______________________________________________
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