Difference between revisions of "System Log"

From The iPhone Wiki
Jump to: navigation, search
m (It is not "Terminal.app".)
(constantly writing to the disk should be considered an alternative; improve other stuff)
Line 1: Line 1:
  +
== Reading syslog ==
==bgm's trick for enabling system log==
 
  +
=== On-device ===
# In the shell, do: echo "*.* /var/log/syslog" > /etc/syslog.conf
 
  +
<!-- TODO: Add a description of what socat is
# Add the following tags to /System/Library/LaunchDaemons/com.apple.syslogd.plist after the tag <string>/usr/sbin/syslogd</string>
 
  +
-->As [[iOS]] is [[wikipedia:Unix|Unix]] based, it comes as no surprise that its syslog can be read using the same tools desktop Unix and [[wikipedia:Linux|Linux]] power users use; provided the tools are compiled for ARM. The most common tool is <code>socat(1)</code><sup>[{{man|socat|1}}]</sup>. If you don't have it yet, just run an <code>apt-get</code> on the package <code>socat</code>. In order to use it, just connect to the syslog socket with the following command:
<string>-bsd_out</string>
 
  +
socat - UNIX-CONNECT:/var/run/lockdown/syslog.sock
<string>1</string>
 
  +
This gives an interactive shell with the syslog daemon (no need to enable file output). If you execute the <code>watch</code> command, a backlog of messages will be printed and new messages will be printed as they arrive.
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]]
 
  +
# "reboot & enjoy your kernel and other messages" (bgm)
 
  +
=== On OS X through [[lockdownd]] ===
  +
<!-- TODO: Add explanation
  +
-->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. Ryan Petrich's [https://github.com/rpetrich/deviceconsole deviceconsole] also provides the same functionality with useful color-coding.
  +
  +
=== On Windows through [[lockdownd]] ===
  +
Apple's [http://support.apple.com/kb/dl1466 iPhone Configuration Utility] can display the syslog on Windows.
   
  +
=== bgm's trick for enabling system log ===
== Note ==
 
  +
This method will constantly write syslog output to a file. This is not recommended as it is slower, and can become fairly large. Install "syslog to /var/log/syslog" from [[saurik]]'s repo and reboot your device. <tt>/var/log/syslog</tt> will now be appended to automatically, and you can watch it like so:
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).<br>
 
  +
tail -f /var/log/syslog
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.
+
If you keep your device full of data, be careful you don't fill the disk. Unix systems tend to break when they can't write to the syslog. Keep an eye on it or employ some log rotation.
   
To disable, enter [[MobileTerminal]] and run:
+
To disable syslog writing, run:
 
rm /var/log/syslog;
 
rm /var/log/syslog;
 
mknod /var/log/syslog c 3 2
 
mknod /var/log/syslog c 3 2
 
This will delete (<tt>rm</tt>) the file and create a [[:/dev/null]]. (<tt>mknod *** c 3 2</tt>)
 
This will delete (<tt>rm</tt>) the file and create a [[:/dev/null]]. (<tt>mknod *** c 3 2</tt>)
   
To reenable, enter [[MobileTerminal]] and run:
+
To re-enable syslog writing, run:
 
rm /var/log/syslog
 
rm /var/log/syslog
 
touch /var/log/syslog
 
touch /var/log/syslog
Line 23: Line 29:
 
This will delete (<tt>rm</tt>) the file and and make a blank regular file. (<tt>touch</tt>)
 
This will delete (<tt>rm</tt>) the file and and make a blank regular file. (<tt>touch</tt>)
   
== SBSettings Toggle ==
+
==== SBSettings Toggle ====
An SBSettings [http://apt.thebigboss.org/onepackage.php?bundleid=sbsettingssyslogd toggle] for enabling/disabling syslog is available at BigBoss' Cydia repository. The <tt>syslog &gt; /var/log/syslog</tt> package from [[User:Saurik|saurik]]'s repo is not a dependency and you must manually install it also.
+
An SBSettings [http://apt.thebigboss.org/onepackage.php?bundleid=sbsettingssyslogd toggle] for enabling/disabling the syslog in this way is available at BigBoss' Cydia repository. Ensure "syslog to /var/log/syslog" is installed - the toggle package hasn't marked it as a dependency.
 
== Reading syslog ==
 
=== [[MobileTerminal]] ===
 
<!-- TODO: Add a description of what socat is
 
-->As [[iOS]] is [[wikipedia:Unix|Unix]] based, it comes as no surprise that its syslog can be read using the same tools desktop Unix and [[wikipedia:Linux|Linux]] power users use; provided the tools are compiled for ARM. The most common tool is <code>socat(1)</code><sup>[{{man|socat|1}}]</sup>. If you don't have it yet, just run an <code>apt-get</code> on the package <code>socat</code>. 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 <code>watch</code> command, the shell will print out new messages as they arrive.
 
 
=== With a Mac through [[lockdownd]] ===
 
<!-- TODO: Add explanation
 
-->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.<!-- dead link? -->
 
   
 
== Reference ==
 
== Reference ==

Revision as of 21:40, 4 January 2014

Reading syslog

On-device

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, a backlog of messages will be printed and new messages will be printed as they arrive.

On OS X 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. Ryan Petrich's deviceconsole also provides the same functionality with useful color-coding.

On Windows through lockdownd

Apple's iPhone Configuration Utility can display the syslog on Windows.

bgm's trick for enabling system log

This method will constantly write syslog output to a file. This is not recommended as it is slower, and can become fairly large. Install "syslog to /var/log/syslog" from saurik's repo and reboot your device. /var/log/syslog will now be appended to automatically, and you can watch it like so:

tail -f /var/log/syslog

If you keep your device full of data, be careful you don't fill the disk. Unix systems tend to break when they can't write to the syslog. Keep an eye on it or employ some log rotation.

To disable syslog writing, 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 re-enable syslog writing, 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 the syslog in this way is available at BigBoss' Cydia repository. Ensure "syslog to /var/log/syslog" is installed - the toggle package hasn't marked it as a dependency.

Reference