I need to record an log even if device restarts cause when I open a specific app my phone restarts so I need to log why.
As you can reproduce the crash you can connect your phone via USB to a computer and start
adb logcat -b all
and then start the problematic app on the device.
You will get the logcat output until the device reboots. Hopefully there is an indicator why the crash happens.
Note: this requires enabled adb on the device and adb running on your PC.
There is a second way reading the kernel messages after the reboot happens, but the path (e.g.
/proc/last_kmsg) of the saved kernel messages have changed over the time and it is not enabled by default on all devices.
If you are interested in this way see for example this topics: