How to update game session log in Unreal

Hello, I am currently trying to debug an issue I’m having with accepting player sessions. Currently, I have a fleet and game instance set up and whenever players are joining, their sessions go from the reserved to timed out state. So I’m trying to add debug statements like so in my Unreal C++ code,


void AFortniteCloneGameMode::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage) { #if WITH_GAMELIFT
FString PlayerSessionId = UniqueId.ToString();
FGameLiftServerSDKModule* gameLiftSdkModule = &FModuleManager::LoadModuleChecked<FGameLiftServerSDKModule>(FName("GameLiftServerSDK")); FGameLiftGenericOutcome outcome = gameLiftSdkModule->AcceptPlayerSession(*PlayerSessionId); UE_LOG(LogMyServer, Log, TEXT("AMyProjectGameMode::PreLogin: Client connecting with attempting to connect with GameLift PlayerSessionId: %s"), *PlayerSessionId); if (!outcome.IsSuccess())
{
ErrorMessage = outcome.GetError().m_errorMessage;
UE_LOG(LogMyServer, Log, TEXT("AMyProjectGameMode::PreLogin: Client connecting with invalid GameLift PlayerSessionId: %s, Error: %s"), *PlayerSessionId, *ErrorMessage); } #endif
}

8162-capture.png

However, the Download Log button in my game instance is still disabled. Any help would be appreciated!

Apologies for the late reply.

Logs are only available for game sessions once they are terminated. Game sessions that don’t go active do not upload logs at this time. We are looking at making improvements to the logging experience this year that will hopefully help debug situations like this.

If you provide a fleet-id/game session id we may have captured the process logs, but they are not available via the GetGameSessionLogUrl.

You can also directly log into an instance to tail the logs to see where things are failing

Connecting to Instances

To get remote connection details for an instance there are 2 ways:

  1. using the get-instance-access command in the AWS CLI
  2. using the GetInstanceAccess API

Hi, appreciate the response.

In that case, how would I go about terminating game instances? I’m not sure how to terminate them besides from terminating the fleet.

If your game sessions are not going active then terminating will not get you the locals. The best there is to use either Gamelift local or remotely access an instance in your fleet to debug in real time.

If your game sessions are going active, ensure you are calling TerminateGameSession and/or ProcessEnding as per

https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api.html

I was able to start the game session in the end as I ended up debugging locally. Just out of curiosity, is there a way to use the command line to end a game session? Thanks again for your help thus far.