Android system log file location
Just to clarify further:
- in Ubuntu, the
syslog
POSIX function in Ubuntu writes to/var/log/syslog
- in Android NDK,
syslog
outputs to logcat: What is the Log API to call from an Android JNI program? - the Java analogue is
android.util.Log
: How do I write outputs to the Log in Android? but this one is hard to compare with Ubuntu since this API does not exist in Ubuntu
There are a few ways to view the System-Log - but finding the location of the log files is considerabaly harder. I will list 3 options that will allow you to view the logs (either on a device or computer), but I do not know where they are kept. I may be wrong, but from what I have gather, the Android System does not keep a "Log File". Rather, there is a buffer that contains the "Log" (again I may be wrong on this)!
You first option is to install an app from the play-store called
aLogCat
. This app is very useful for both viewing and sending logs from your device. It can be setup to Email you the "Log Files" from your device. This method works best with root.
The second method works by using the Android SDK. Connect your device (with USB-Debugging enabled) and, at a Terminal enter the following:
$ adb logcat -d > logcat.txt
The -d
option tells adb
to copy the entire File Log from the Android System. Because you seem to know how UNIX Systems work, I won't explain the rest of the command.
A third option (if you are rooted, that is) is to install a Terminal Emulator on your Android device. Open the Terminal Emulator and enter the command:
$ logcat -d > /sdcard/my-log-file.txt
This will do the same as above (except you don't need a computer, and the file saves on your device/SDcard.
Feel free to change the "/sdcard/my-log-file.txt
" part to anything you like, but I strongly recommend you save it to either your external or internal storage - so in short: Save it to a location you can accsess without #
(superuser) permission!