how to check log to find the reason?
Nah, that’s not persistent. The content gets lost upon reboot.
There is nothing in QNX that logs a shutdown was performed. If the hardware rebooted on its own there is no way for QNX (or any OS) to know the reason.
Can’t you use the ‘-l fname’ option to log to a file in addition to RAM?
Then you can have your .altboot image set up to use the ‘-l fname’ option and then start QNX via the altboot image so that when it gets restarted the file doesn’t get over written.
This clearly doesn’t help in the case that a hardware watchdog or some other hardware failure / power loss causes the reboot since nothing is going to get logged but it might help if it’s software related in some manner.
If it’s shutdown properly the file will be valid. But then if it’s shutdown properly you should know about it.