2 Replies Latest reply: Feb 14, 2010 6:18 PM by Adam Bryzak
Adam Bryzak Level 1 (0 points)
I've hit an issue with idle sleep being prevented because of logging. Each request my application makes, possibly two per minute or so logs a message with NSLog, which is causing idle sleep to be prevented. Besides not logging the requests, which is undesirable as they're useful to find problems after they happen, is there anything I can do to allow the system to sleep if all I'm doing is logging?

MacBook Pro 13" Mid-2009, Mac OS X (10.6.2), 160GB Intel X25-M Gen2 SSD
  • xnav Level 5 (6,635 points)
    You probably have to manage this yourself by making your app aware of the systems desire to go idle and quiesce your logging. Try looking at [this|http://developer.apple.com/mac/library/technotes/tn2002/tn2075.html]
  • Adam Bryzak Level 1 (0 points)
    I looked at the I/O Kit power management notifications (IORegisterForSystemPower) but unfortunately the callback only appears to be called after the system has determined that idle sleep is possible, which means the logs will prevent the callback. For now I'll just add a preference to enable verbose logging and suppress the most common log messages unless it's enabled.