• 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
Log File Watcher
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Log File Watcher


  • Subject: Log File Watcher
  • From: email@hidden
  • Date: Mon, 5 Nov 2007 22:15:22 +0100
  • Resent-date: Mon, 5 Nov 2007 22:18:24 +0100
  • Resent-from: email@hidden
  • Resent-message-id: <email@hidden>
  • Resent-to: email@hidden

Hi there

I tried to make something like a log file watcher (like tail):

---
- (void)awakeFromNib {
	logFile = [[NSFileHandle fileHandleForReadingAtPath:LOGFILE] init];
	if (!logFile)
       return;
	[logFile seekToEndOfFile];
	[[NSNotificationCenter defaultCenter] addObserver:self
											 selector:@selector(fileDataAvailable:)
												 name:NSFileHandleReadCompletionNotification
											   object:logFile];
	[logFile readInBackgroundAndNotify];
}

- (void)fileDataAvailable:(NSNotification*)note {
	NSLog(@"new entry %@", [[NSString alloc] initWithData:
							[[note userInfo] objectForKey:NSFileHandleNotificationDataItem]
												 encoding:NSUTF8StringEncoding]);
	[logFile readInBackgroundAndNotify];
}
---

The problem is, I now get e "new entry" all the time... The [note userInfo] is empty.

---
2007-11-05 22:11:26.502 MyApp[4381:10b] new entry
2007-11-05 22:11:26.504 MyApp[4381:10b] new entry
2007-11-05 22:11:26.504 MyApp[4381:10b] new entry
---

Any help is appreciated.

Nils
_______________________________________________

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


  • Prev by Date: Re: I'm losing my memory (GC & NSImageView)
  • Next by Date: Re: Submenus of toolbar items?
  • Previous by thread: Re: Struct introspection or information
  • Next by thread: DTrace Scripts Site
  • Index(es):
    • Date
    • Thread