Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

External log file viewer

Discussion in 'General Discussion' started by frosted, Jul 8, 2023.

  1. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    I'm looking for a lightweight log viewer that works outside of unity and does not require some kind of project installation or integration with unity.

    Again, not looking for something that runs within unity - an external app that opens log files and displays them nicely. Everything I've found requires some kind of integration or is running within unity or some madness. I'm mostly looking for a tool for quickly browsing logs files sent by others.

    Anyone know of anything?
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,642
    VSCode/Notepad++?
     
    angrypenguin likes this.
  3. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    Like, I want stack traces collapsed and markup displayed properly.

    In a dream world it'd also support double click to jump to file.
     
    PhoenixAdvanced likes this.
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    That log viewer would have to be programmed specifically targeting Unity's log file format - which isn't even standardized in itself, basically every subsystem could log things differently. Only exception (no pun) is probably all the global logs like exceptions.

    Text editors have powerful search (regex), filter and sort tools that you could use to clean up the editor log. My guess is most who share your pain probably don't look for an app but a regex instead. ;)
     
    CodeRonnie likes this.
  5. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,642
    The problem here is that there's no universal log file format. You'd have to jury-rig something for specific usecase.
     
    CodeRonnie likes this.
  6. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    535
    In researching loggers I came across a logging pattern where a format string is logged, along with all of the objects to be formatted into it. Some log targets are in the cloud and store all of those separate objects in a database. The web view of those logs can then provide custom formatting, filtering, and allow you to select objects, etc. I chose not to support that pattern because I was more concerned with garbage memory allocation and didn't want to encourage boxing value types into objects. However, there is precedent for something like what you're describing through 3rd party logging frameworks and specialized log targets in the cloud. I can't remember any of the product names off the top of my head. Usually they are used outside of Unity, in traditional .Net applications, from what I can tell. As has been mentioned, Unity may have some log format conventions, but there isn't really a standard for how any given log file may be formatted. Log file formats can be highly customized to suit the preferences of whoever is writing the logs. Specialized highlighting and displaying of that raw text would be dependent on customizable rules appropriate to the expected format of the type of logs provided to the viewer application.
     
  7. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,646
    I don't know if it'd be that difficult.
    - They all start with a time stamp of easily recognisable format.
    - If they end with a stack trace it's always at the end, in an easily recognisable format.
    - The stuff in between is a message which can be treated as an arbitrary string.
    - It'd be pretty straightforward to add some filters which operate on top of that, e.g.:
    - Show only stuff with / without stack traces
    - Show only stuff with a specified string in either message / stack trace section
    - Allow collapsing of message / stack trace
    - Suppress sequential duplicates​
     
    frosted and Antypodish like this.
  8. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    4,044
    These are some pretty wild responses. What I'm looking for is basically a unity console window that can open a log file and lives external to unity.

    You guys are overcomplicating the hell out of this.
     
  9. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,642
    But this is the way!

    If you only need this much, see if you can jury-rig VSCode extension, or throw together some basic TextEdit in any GUI framework. Qt would work.
     
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,820
    You can write small app in python if you like. Will be external and simple.

    Or even in lua, if you mad enough :)

    But equally you can write simple app in Unity, which will do exact the same. Plus you have access to nicer UI. And writing an C#, rather than python.

    Just follow the pattern in log file, which is clearly visible. It splits into sections like header, content, and some end of the log file.

    Content are where stack traces are printed out. They are always follow the same pattern.
     
  11. Iron-Warrior

    Iron-Warrior

    Joined:
    Nov 3, 2009
    Posts:
    838
    Stumbled across this thread looking for something similar, didn't find anything so I made my own.

    https://github.com/IronWarrior/UnityLogViewer

    Only took a couple days, but pretty worth it considering how much time I've been spending after a release reading logs players submit.
     
    PhoenixAdvanced and Ryiah like this.
  12. wuhuan

    wuhuan

    Joined:
    Mar 12, 2014
    Posts:
    10
    DragonCoder and angrypenguin like this.