how to get log file for Android

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alternatif

Hello,

I would like to enable logging files for an android app mainly to detect bugs and such while using the app and not just while using ADB logcat.

I also know that I can’t access the user:// folder on my Android or at least I wasn’t able to find it on my phone, I guessed it’s probably hidden.

I don’t know what to put inside the “logging/file_logging/log_path” project parameter that could make it work for Android. I would like to output logs inside the storage/Documents of Android so they could be fetched and read easily.

So far I wasn’t able to produce any log file on Android and would like to know how to do it or if it is even possible?

:bust_in_silhouette: Reply From: Calinou

I don’t know what to put inside the “logging/filelogging/logpath” project parameter that could make it work for Android. I would like to output logs inside the storage/Documents of Android so they could be fetched and read easily.

As of writing, this is not possible yet as full support for Android scoped storage isn’t merged yet.

Thank you for your Answer,

I’ll be following that merge closely then.
In the meantime, I’ll try to find a workaround for logs on android I guess

alternatif | 2022-03-21 13:32

:bust_in_silhouette: Reply From: alternatif

So I dig into it and found a “nice” workaround where I display the log file inside the app.

I learnt that you have acces to the “user://” folder. I also learnt that if the project property “logging/filelogging/logpath” is set to “user://logs/godot.log”/ it really does log file.

from there I just list all the files inside the “user://logs/” folder and let the user choose wich log file he wants to display.

finaly I can open the log file and display its content inside a big “Scroller text” container.