Read Apple Watch Syslog (NSLog ()) in real time

I'm looking for a way to read the syslog log in real-time, similar devices Console or is to do it for the iPhone.

It is ok if the phone is connected by usb to the computer while I am reading.

At this point, I'll even settle for a solution that somehow reads real-time texts from Xcode's debug console, though (although I'd rather have a way to connect to syslog in standard mode :) ..



source to share

1 answer

While I couldn't find any official way to get the logs from the device, I was able to write a hack that does this in real time.

It uses the python GUI automation library to pull text from the Xcode console window.

Please note that this solution has its limitations:

  • requires the phone to connect to the computer via a cable
  • contains only logs from your own application, so it doesn't match the tools mentioned earlier.

However, this solved my problem and I am posting the python shortcode in the hope that it will help other developers.

import atomac

def get_console():
    xcode = atomac.getAppRefByBundleId('')

def run():
    console = get_console()
    while True:
        clog = console.AXValue[-1000:]
        last_read = clog.split("\n")[-2]
        print last_read

if __name__ == "__main__":


Note that you will have to play with some indexes inside get_console () to get the console window in Xcode setup.

(If you're interested, this hack code was written for the hackathon project as a way to get fast data from the watch, as it couldn't send UDP packets on WatchOS2 Beta 4 and the official ways to send data from the watch [for example sendMessageData:replyHandler:errorHandler:

] were too slow for that , what do we need).



All Articles