System Log

From The iPhone Wiki
Revision as of 20:50, 28 July 2013 by 5urd (talk | contribs) (rewrote the terminal access portion and grouped the two sections on reading the syslog)
Jump to: navigation, search

bgm's trick for enabling system log

  1. In the shell, do: echo "*.* /var/log/syslog" > /etc/syslog.conf
  2. Add the following tags to /System/Library/LaunchDaemons/com.apple.syslogd.plist after the tag <string>/usr/sbin/syslogd</string>
<string>-bsd_out</string>
<string>1</string>

This will tell the Daemon Launcher to call /usr/sbin/syslogd -bsd_out 1, and we have configured it to write all messages to /var/log/syslog

  1. "reboot & enjoy your kernel and other messages" (bgm)

Note

The syslog will grow very big quite quickly if you use WinterBoard's debug setting, but the folder /private/var/log is on the data partition (music, etc).
If you keep your device full of music, be careful you don't fill the partition. Unix systems tend to break when they cant write to the syslog. Keep an eye on it or employ some log rotation.

To disable, enter Terminal.app and run:

rm /var/log/syslog;
mknod /var/log/syslog c 3 2

This will delete (rm) the file and create a /dev/null. (mknod *** c 3 2)

To reenable, enter Terminal.app and run:

rm /var/log/syslog
touch /var/log/syslog

This will delete (rm) the file and and make a blank regular file. (touch)

SBSettings Toggle

An SBSettings toggle for enabling/disabling syslog is available at BigBoss' Cydia repository. The syslog > /var/log/syslog package from saurik's repo is not a dependency and you must manually install it also.

Reading syslog

Terminal.app

As iOS is Unix based, it comes as no surprise that its syslog can be read using the same tools desktop Unix and Linux power users use; provided the tools are compiled for ARM. The most common tool is socat(1)[man]. If you don't have it yet, just run an apt-get on the package socat. In order to use it, just connect to the syslog socket with the following command:

socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock

This gives an interactive shell with the syslog daemon (no need to enable file output). If you execute the watch command, the shell will print out new messages as they arrive.

With a Mac through lockdownd

A binary (and its source code) to view ASL messages from Mac using the MobileDevice.framework has been made available on http://newosxbook.com/index.php?page=downloads.

Reference