Search Unity

Including player log file in report?

Discussion in 'Unity Cloud Diagnostics' started by dgoyette, Jan 15, 2019.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,765
    I'm not sure if I've missed this, but is there an option to include the player log file in the bug report? I think it's very helpful to look through log files, proactively checking for issues that don't cause actual crashes. I tried to open and read the log file manually (using System.IO classes), but I ended up getting permissions errors trying to read the log file while the game was running.
     
  2. bretth_unity

    bretth_unity

    Unity Technologies

    Joined:
    Dec 1, 2016
    Posts:
    34
    We send the console output but we do not send the player log. What information do you want to see that is in the player log but not in the console output?
     
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,765
    Well, my plan has been to submit the log file periodically, and just check for any interest log entries over many session. But in researching this response, I see that the log file gets cleared every time the game is started, meaning that the log file will never contain entries for multiple sessions. So...that likely means that just the console output is sufficient. So I guess I'm all set. Thanks.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,765
    I'm getting back to looking at this after thinking things were working well, but now I'm finding that it doesn't seem like log entries are making it into my submissions. Here's some content from my log file, written there via Debug.Log():

    Time: 31.40243; Collider: Cube; Force: 4328.663
    UnityEngine.DebugLogHandler:Internal_Log()
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:KillPlayer(Vector3, PlayerDamageType, Boolean, String) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:1192)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:TakeDamage(Single, Vector3, PlayerDamageType, Nullable`1, Single, String) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:1132)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:HandlePlayerCollision(Collision) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:2209)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:OnCollisionEnter(Collision) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:2136)

    (Filename: C:/Users/Dan/Documents/GitHub/Gravia/Assets/Code/Controllers/Player/FirstPersonCharacterController.cs Line: 1192)

    DEBUG_DIAG|||PlayerDied|||playerPosition===(-86.5, -28.0, 79.1)___timeSinceLevelLoad===31.40243___sceneDefinitionId===BasicTraining_Heights_0___checkpointIndex===1___damageType===FootStrike___damageSourceName===Cube
    UnityEngine.DebugLogHandler:Internal_Log()
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    GraviaSoftware.Gravia.Code.Utilities.DebugUtil:DebugDiag(DebugDiagnosticsEntryType, Func`1) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Utilities\DebugUtil.cs:22)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:KillPlayer(Vector3, PlayerDamageType, Boolean, String) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:1271)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:TakeDamage(Single, Vector3, PlayerDamageType, Nullable`1, Single, String) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:1132)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:HandlePlayerCollision(Collision) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:2209)
    GraviaSoftware.Gravia.Code.Controllers.Player.FirstPersonCharacterController:OnCollisionEnter(Collision) (at C:\Users\Dan\Documents\GitHub\Gravia\Assets\Code\Controllers\Player\FirstPersonCharacterController.cs:2136)

    (Filename: C:/Users/Dan/Documents/GitHub/Gravia/Assets/Code/Utilities/DebugUtil.cs Line: 22)

    There are several entries like this, however none of that log content ends up in the bug report. When I log into Cloud Diagnostics to view the user report, the report contains only a single "event", named "Creating bug report."

    Do I need to enable something on the Bug Report object to include the Debug.Log content? Or do I need to do something other than Debug.Log to write diagnostics info in such a way that it will show up on the report?

    Thanks.
     
  5. bretth_unity

    bretth_unity

    Unity Technologies

    Joined:
    Dec 1, 2016
    Posts:
    34
    Make sure
    UserReportingClient.UserReportingClient
    is set to
    true
    .

    User Reporting subscribes to the
    Application.logMessageReceivedThreaded
    for reporting log messages, so make sure your messages are appearing there.
     
  6. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,765
    Thanks, Brett. I'm actually using BugReportingClient, not UserReportingClient, as in:

    Code (CSharp):
    1. UnityBugReporting.CurrentClient.SendBugReport(this._bugReport, progressCallback, completedCallback);
    This is code I was using when bug reporting was in alpha. I've since updated the plugin, as recommended, but I don't remember it requiring any changes to the code I was using. Is this still the right approach for submitting user reports to cloud diagnostics? Or should I be using a UserReportingClient approach these days?
     
  7. johng_unity

    johng_unity

    Unity Technologies

    Joined:
    Nov 5, 2015
    Posts:
    158
    Hi - yes, you should be using the UserReporting sdk now. More details here:

    https://forum.unity.com/threads/ple...rting-alpha-sdk-by-february-15th-2019.613795/
     
  8. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,765
  9. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    1,765
    Hi Brett,

    Since your post, I've properly migrated my code to use UnityUserReporting, instead of UnityBugReporting. I don't see the field you suggested using. I did see a field "IsConnectedToLogger", which I've tried setting to true:

    Code (CSharp):
    1. UnityUserReporting.CurrentClient.IsConnectedToLogger = true;
    2.             UnityUserReporting.CurrentClient.CreateUserReport((ur) =>
    However, this doesn't appear to cause log messages (emitted via Debug.Log()) to appear on the user report. It also causes the User Report's SendUserReport method to result in success = false when submitting with IsConnectedToLogger set to true. (I get success = true if I don't set IsConnectedToLogger to true.) Could you let me know if this isn't working properly right now, or if I have the wrong field?