Search Unity

Upload game debug logs from user devices (Android & iOS)

Discussion in 'Unity Analytics' started by noambe, Mar 17, 2021.

  1. noambe

    noambe

    Joined:
    Aug 13, 2014
    Posts:
    32
    Hi,

    I'm not sure if that's the right forum to ask, but I am looking for a way to ask some of my users that run into a specific problem to send me their game logs.

    I couldn't find any resource that would explain how to retrieve all the logs that were written via Debug.Log during a gams session.

    I assume there is a file that these files are written to. Is there an API to fetch this file, on both Android and iOS?

    Bonus points- an API to print all the relevant info about the device and its version.

    Thanks,
    Noam
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Not easily. Your users would need to install Android Studio and run "adb logcat" after putting their phone into debug mode and connecting via USB.https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/
     
  3. noambe

    noambe

    Joined:
    Aug 13, 2014
    Posts:
    32
    I am looking for a high level solution for end users that won't involve special tooling or being physically next to a computer. It also has to support iOS as well and not just Android.

    A naive solution would be to wrap Debug.Log calls and store them locally in a file (with finite buffer) and then send it when the user clicks a button in the app like "report an issue". But my question is if there's already something built in for this? It sounds like basic infra each app needs.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Nothing built-in unfortunately. But it's a great idea, I've actually suggested it to engineering myself.
     
  5. noambe

    noambe

    Joined:
    Aug 13, 2014
    Posts:
    32
    Are you familiar with a 3rd party plugin that does this? I'm not coming up with something new, every basic app these days has a way to get user logs after they report a problem. I'll be shocked if each one of them came up with a custom solution of their own...
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Not that I'm aware of, perhaps in the Asset Store? Typically those logs are remotely captured through a crash reporting service like https://unity3d.com/unity/features/cloud-diagnostics which is convenient for the user, they don't need to take any action. But often issues arise that don't generate exceptions, just incorrect behavior.
     
  7. sergioabril

    sergioabril

    Joined:
    Jan 11, 2016
    Posts:
    33
    Recently came up with this problem, and even though it is not the real thing, and there might be a better solution, this allowed me to gather certain Log events into a variable, and be able to fetch them to send user reports later:

    https://answers.unity.com/questions/125049/is-there-any-way-to-view-the-console-in-a-build.html

    I just removed the following part, since I don't want to print them anywhere:

    Code (CSharp):
    1. void OnGUI()
    2. {
    3. //if (!Application.isEditor) //Do not display in editor ( or you can use the UNITY_EDITOR macro to also disable the rest)
    4. {
    5. myLog = GUI.TextArea(new Rect(10, 10, Screen.width - 10, Screen.height - 10), myLog);
    6. }
    And that's it.

    When the user taps on a specific place, I write the contents of the variable into a .txt file, and send it to me by email.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, that's similar to what I do in the Sample IAP Project. However, this assumes the issue isn't caused by a crashing exception. If the game crashes, you can't send the log. It is good for informational debugging however https://forum.unity.com/threads/sample-iap-project.529555/#post-6950270
     
    sergioabril likes this.