• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Effectively fetching console messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Effectively fetching console messages


  • Subject: Re: Effectively fetching console messages
  • From: Luke the Hiesterman <email@hidden>
  • Date: Fri, 28 Nov 2008 10:08:47 -0800

One problem with reading the file directly is that system.log is owned by root:admin with no read permission granted to other users. Ideally, I wouldn't want my app to require special privilege elevation to run on a standard user's account.

Luke


On Nov 28, 2008, at 9:48 AM, Martin Stoufer wrote:

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


References: 
 >Effectively fetching console messages (From: Luke the Hiesterman <email@hidden>)
 >Re: Effectively fetching console messages (From: Martin Stoufer <email@hidden>)

  • Prev by Date: Re: NSTrackingArea strange requirement
  • Next by Date: Re: Garbage collection leak in simple Core Data application
  • Previous by thread: Re: Effectively fetching console messages
  • Next by thread: Main Thread stoppin Background Thread
  • Index(es):
    • Date
    • Thread