NSLog preventing Idle Sleep

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

Posted on Feb 14, 2010 4:16 PM

Reply
2 replies

Feb 14, 2010 6:18 PM in response to xnav

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.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

NSLog preventing Idle Sleep

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.