Search Unity

How can I view the console output for a game running on a remote linux server?

Discussion in 'Connected Games' started by BenjaminAlbrecht, Sep 9, 2019.

  1. BenjaminAlbrecht

    BenjaminAlbrecht

    Joined:
    Apr 27, 2019
    Posts:
    3
    I built my game as a .x86_64 file and deployed it on a remote server via docker. The server is running Ubuntu 18.04 and I'm using Git Bash to SSH in. How can I view the console/debug output for the game?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,340
    If you mean the console output such as in the editor, that is output to the log file like any standalone build.
    https://docs.unity3d.com/Manual/LogFiles.html

    You can use the -logFile command line argument when you launch your game to direct the log file to a custom location.
    https://docs.unity3d.com/Manual/CommandLineArguments.html

    If you mean actual console output, like you're printing to the terminal (which I haven't bothered trying from Unity in Linux), you can probably just use usual Unix/Linux output redirects to a file. Then you can tail that file to get updated on the current output. Maybe something like below.

    Code (csharp):
    1. ./blahgame.x86_64 -logFile ./myLogFile.log > ./currentoutput.txt
    Code (csharp):
    1. tail -F ./currentoutput.txt
     
  3. doctorpangloss

    doctorpangloss

    Joined:
    Feb 20, 2013
    Posts:
    216
    Typically docker applications are authored to print all console output to standard out. However, if you don't start the application with a pseudo-tty (i.e., the "-t" option), you will sometimes not see console output. This is especially true if you use s6-overlay.

    Also, you typically do not bash into a running container to view logs. Use an orchestrator, like kubernetes (complicated) or docker swarm + portainer (easy), which will give you an easy-to-use website to view logs from your containers (i.e., processes).



    If this seems like a lot of IT for you, another choice is to configure an ILogger (a Unity interface for logging) that sends logs to a cloud log provider, like AWS CloudFront. There, you can view and search the logs in their interface.
     
    Joe-Censored likes this.