question

rmontino avatar image
rmontino asked

Getting Unity logs from game server

I've tried Unity's "Server build" where the logs go to the console but still my "archived server" logs are all empty.

This post suggests re-directing Unity logs to "log_file_path" but the Unity GSDK doesn't have an API call to get it. Is it a well-known path?

https://community.playfab.com/questions/669/208506448-Log-Path-on-Dedicated-server.html

unity3d
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmontino avatar image
rmontino answered

FYI, I could not get Unity on Windows talking to Playfab's multiplayer agent via stdout. But, after a week of searching I found the environment variable PF_SERVER_LOG_DIRECTORY that can be added to the start command, ie. yourgame.exe -logFile "%PF_SERVER_LOG_DIRECTORY%\Server.log", which makes logs available after the server terminates. I also found that while the server is running you can remote desktop in and copy the logs.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Made Wang avatar image
Made Wang answered

[Edited] Referring to the settings in MpsSamples/UnityMirror at main PlayFab/MpsSamples (github.com), set StartGameCommand to C:\\Assets\\UnityServer.exe -nographics -batchmode -logFile to get the log file.

You can debug locally to see if there is any log output, refer to LocalMultiplayerAgentOverview - PlayFab | Microsoft Docs.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

KIQQI PRODUCTONS d.o.o. avatar image
KIQQI PRODUCTONS d.o.o. answered

I've been trying to figure out server debug and logs for a week now.

NOTHING works :) I just keep getting empty zip.

Last what I did was added "-logFile <log_file_path>" to the executable and it merely makes server build to restart in loop.

To playfab team or anyone - can you just make it obvious simple for us and provide us with log directory to link or something?

Right now it's impossible to debug app/game :/
Thank you

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmontino avatar image
rmontino answered

@Made Wang Thank you for the reply. Just to be painfully clear. Is this a proper start command...

"YourGameHere.exe -logFile <log_file_path>" or do I substitute "<log_file_path>" for a valid path?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

@KIQQI PRODUCTONS d.o.o. @rmontino we grab all logs from standard output as well, can you try -logfile -nographics -batchmode?

MpsSamples/Dockerfile at 66d31f32de252f9184700e04dba5fde8c62dba1d PlayFab/MpsSamples (github.com)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmontino avatar image
rmontino answered

@Dimitris Gkanatsios @Made Wang I tried both to no avail. Local multiplayer agent output below...

1) Does the "<log_file_path>" trick only work when running in a container?

2) Does the server have to do anything other than call Application.Quit?

"Root output folder: D:\Output\PlayFabVmAgentOutput\2022-07-06T07-50-48 info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users\RAM GAMING\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. Local Multiplayer Agent is listening on port 56001 Player1, Player2 info: PlayFabLocalMultiplayerAgent[0] Starting process for session host with instance number 0 and process info: FileName - D:\Output\PlayFabVmAgentOutput\2022-07-06T07-50-48\ExtAssets\SH0\A0\AshOfLegends.exe, Args - -batchmode -nographics -debug exceptions -debug multiplayer -debug nonvrcamera -logFile <log_file_path>. info: PlayFabLocalMultiplayerAgent[0] Creating the configuration file at D:\Output\PlayFabVmAgentOutput\2022-07-06T07-50-48\Config\SH0\gsdkConfig.json info: PlayFabLocalMultiplayerAgent[0] Started process for session host. Instance Number: 0, UniqueId: 29aca760-a885-4233-8a6a-19065e6225fa, ProcessId: 19772 info: PlayFabLocalMultiplayerAgent[0] Waiting for heartbeats from the game server..... Unable to open log file, exiting. PS D:\PlayFabVmAgent>"

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

Are you building the Unity server executable as a dedicated server?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmontino avatar image
rmontino answered

@Dimitris GkanatsiosYes, I tried the "Server build" checkbox in the Build Settings. I verified that Unity's log comes out to the console (stdout). Output of local multplayer agent below but still no logs in D:\Output sub-folders.

"Root output folder: D:\Output\PlayFabVmAgentOutput\2022-07-06T16-22-00 info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] User profile is available. Using 'C:\Users\RAM GAMING\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. Local Multiplayer Agent is listening on port 56001 Player1, Player2 info: PlayFabLocalMultiplayerAgent[0] Starting process for session host with instance number 0 and process info: FileName - D:\Output\PlayFabVmAgentOutput\2022-07-06T16-22-00\ExtAssets\SH0\A0\AshOfLegends.exe, Args - -logfile -batchmode -nographics -debug multiplayer -debug nonvrcamera. info: PlayFabLocalMultiplayerAgent[0] Creating the configuration file at D:\Output\PlayFabVmAgentOutput\2022-07-06T16-22-00\Config\SH0\gsdkConfig.json info: PlayFabLocalMultiplayerAgent[0] Started process for session host. Instance Number: 0, UniqueId: e2173282-fdd6-4b26-a03a-f19bbb5e85ec, ProcessId: 34240 info: PlayFabLocalMultiplayerAgent[0] Waiting for heartbeats from the game server...."

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dimitris-Ilias Gkanatsios avatar image
Dimitris-Ilias Gkanatsios answered

@rmontino we gather the output from stdout when the game server process stops executing, doesn't this happen in your case? I don't see any logs from your game server in the above paste

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmontino avatar image
rmontino answered

@Dimitris Gkanatsios So I made a hello world sample. Same result. No logs in "logFolder". Code and output attached. MultiplayerSettings.json inline...

{ "RunContainer": false, "OutputFolder": "D:\\Output", "NumHeartBeatsForActivateResponse": 10, "NumHeartBeatsForTerminateResponse": 30, "AgentListeningPort": 56001, "AssetDetails": [ { "MountPath": "C:\\Assets", "LocalFilePath": "E:\\Unity\\Playfab2\\bin\\bin.zip" } ], "DeploymentMetadata": { "Environment": "LOCAL", "FeaturesEnabled": "List,Of,Features,Enabled" }, "GameCertificateDetails": [], "PortMappingsList": [ [ { "NodePort": 60001, "GamePort": { "Name": "bolt_server", "Number": 60001, "Protocol": "UDP" } }, { "NodePort": 5055, "GamePort": { "Name": "master_server1", "Number": 5055, "Protocol": "UDP" } }, { "NodePort": 27001, "GamePort": { "Name": "master_server2", "Number": 27001, "Protocol": "UDP" } }, { "NodePort": 5056, "GamePort": { "Name": "game_server1", "Number": 5056, "Protocol": "UDP" } }, { "NodePort": 27002, "GamePort": { "Name": "game_server2", "Number": 27002, "Protocol": "UDP" } }, { "NodePort": 5058, "GamePort": { "Name": "name_server1", "Number": 5058, "Protocol": "UDP" } }, { "NodePort": 27000, "GamePort": { "Name": "name_server2", "Number": 27000, "Protocol": "UDP" } } ] ], "ProcessStartParameters": { "StartGameCommand": "Playfab2.exe -nographics -batchmode -logFile" }, "ContainerStartParameters": { "StartGameCommand": "C:\\Assets\\Playfab2.exe -nographics -batchmode -logFile", "ResourceLimits": { "Cpus": 0, "MemoryGib": 0 }, "ImageDetails": { "Registry": "mcr.microsoft.com", "ImageName": "playfab/multiplayer", "ImageTag": "wsc-10.0.17763.2458", "Username": "", "Password": "" } }, "SessionConfig": { "SessionId": "ba67d671-512a-4e7d-a38c-2329ce181946", "SessionCookie": null, "InitialPlaye


10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.