top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to find or log Android phone reboot cause?

+1 vote

For my project I need to know that - is there a way to log or capture the cause of android reboot, whether user manually powered off / rebooted the devices or wether system_server got restarted by adb kill or it was watchdog who restarted the device.

posted Jun 10, 2014 by Rameshwar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

For any Reboot or Shutdown or restart of system_server ShutdownThread is invoked, which contains reason for shutdown or reboot so you can get the reason from there and do anything with it, i.e. log it or write it to file etc.

see rebootReason and methods of ShutdownThread, for each reboot or shutdown run() method of ShutdownThread is internally invoked which internally calls rebootOrShutDown() method (which should not be called from anywhere else also).

answer Jun 10, 2014 by Meenal Mishra
0 votes

Logcat should get you through. So do the trace file and the tombstone file.

adb kill-server has nothing to do with it. If you kill something from the shell, it depends on the signal type.

You will find all "watchdog" related events in the log, and if you customize your own ROM, and want to ease the finding of those events, you can add a single line to the zygotte block of your init.rc

answer Jun 10, 2014 by anonymous
Similar Questions
+2 votes

My Apache server host few applications something like :


I would like to trace access for a specific application, eg. A. Is it possible?

Or should I use 'LogLevel info' and so log all applications into access.log file (then parsing for specific web page) ?

My config for logging is :

ErrorLog /var/log/apache2/error.log
LogLevel info
CustomLog /var/log/apache2/access.log combined
+2 votes

Is there a way to force Tomcat to set permissions on log files when they’re created? It seems as though this would be something defined in the file, but it doesn’t seem like it’s an option.

I want the permissions of all log files created (on server startup/log rollover) to be 640. The only way I can think of doing this is either adding the command to the startup script, or by running a cron job every hour or so. However, if there is a way to make sure the log files are never more permissive than 640, that would be greatly preferable.

+1 vote

I have got a bash script that has two parts.
1. runs a script as a different user (using su -c )
2. when that part finishes, the script does a copy of the files created to another directory
I want to log the output of the entire script into one file. i.e.: internal script>external script> logfile
Whats the best way to do this?

+1 vote

I have a script-service running on a remote server, listening on a specific port. What i need here is to make this also maintain a log file of ALL incoming connections.

Could someone suggest to me a simple codefunction example to implement that on my main running service?