Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Are the crash reports uploaded instantly or in the next session

Discussion in 'Unity Cloud Diagnostics' started by Sailendu, Nov 10, 2019.

  1. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Hello,

    I want to know, when a crash happens, does unity upload the report instantly to cloud diagnostics or it is uploaded when the app is launched again? I mean how does unity upload the report if the app crashed? Because the app will not be running after the crash. I am kind of confused. I am sorry if it is a stupid question.
     
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @Sailendu, that's not a stupid question at all. When a native crash is detected, the stack trace is saved away in a separate report by Cloud Diagnostics on the device. The report must then wait until the app is relaunched before it can be sent to the service since most OS architectures have limitations on what can be sent out by an application that is in the process of crashing, in case what's being sent might further corrupt the device or any services.
     
    Sailendu likes this.
  3. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Hi @ryanc-unity, thanks a lot for replying. Now I can understand. I have one more question, if the reports are sent on relaunch, then let's say my app crashed on version 1.1, then the user downloads an update before relaunching which is 1.2, then when relaunch happens on 1.2 the crash is reported. So if I apply a filter in the cloud diagnostics dashboard to see the crashes for version 1.2 it might include some crashes which actually happened in 1.1 because the crash happened before the update 1.2, can this happen or the version number included in the crash report is actually set to 1.1 even though it is reported from 1.2? Please let me know.
     
  4. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    No problem, happy to help. Unfortunately, the old crash report from 1.1 would come in as saying that it was from 1.2 since it is sent from the new app, which includes its own metadata in the report.
     
    Havokki and Sailendu like this.
  5. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Ryan-Unity likes this.
  6. adityakaishav

    adityakaishav

    Joined:
    Jan 16, 2019
    Posts:
    26
    Hi @ryanc-unity
    I want to save the crash report on my own server instead of Unity cloud. So please let me know or suggest me a way to do that? Currently I am using the below code to save logs in a file in case of Exceptions, Errors etc, at run time in the game. So my question is, is onLogMessageReceived() method also gets called when crash happens? Please let me know or any other way save crash report. Thanks in advance.

    Code (CSharp):
    1. void Awake()  
    2. {
    3.     Application.logMessageReceived += onLogMessageReceived;
    4. }
    5. void onLogMessageReceived(string logString, string stackTrace, LogType type)
    6. {
    7.     output = logString;
    8.     stack = stackTrace;
    9.     log_type = type;
    10.     if (log_type == LogType.Error || log_type == LogType.Exception)
    11.     {
    12.         writeReportInFile();
    13.     }
    14. }
     
  7. xjjon

    xjjon

    Joined:
    Apr 15, 2016
    Posts:
    610
    Maybe Firebase Crashlytics is a better fit for you? You can stream/export error reports to BigQuery (and then your own server/data store).