Skip to content

ACServer Logging to File

Callum Jones edited this page Feb 3, 2020 · 2 revisions

This Wiki entry guides you through setting up Assetto Server Manager to output individual log files when acServer is run. This is done by leveraging the executable_path option in Server Manager's config.yml.

Note: as of Server Manager v1.7.3, this feature is built into Server Manager and enabled by default! Configure Logging under the miscellaneous header in the Server Options!

Windows

On most Assetto Corsa Server installations, you will already have an acServer.bat file in the same folder as acServer.exe. If you do not have this file, you can create it with the contents below:

@echo off
TITLE AC Server
echo Starting AC Server...
SETLOCAL EnableDelayedExpansion
 for /f "skip=1 tokens=1-6 delims= " %%a in ('wmic path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /format:table') do (
        IF NOT "%%~f"=="" (
            set /a _d=10000 * %%f + 100 * %%d + %%a
			set /a _t=10000 * %%b + 100 * %%c + %%e
        )
    )

echo Output is logs/session/output%_d%_%_t%.log

acserver.exe > logs/session/output%_d%_%_t%.log 2> logs/error/error%_d%_%_t%.log

Ensure that this acServer.bat file is next to your acServer.exe.

Finally, edit your Server Manager config.yml file and change the value for executable_path to be acServer.bat.

Linux

Create a file called acServer.sh in the same directory as the acServer executable. The file contents is below:

#!/bin/bash
LOGFILE=`date "+%Y-%m-%d_%H.%M.%S.log"`
./acserver >$LOGFILE

Next, make this file executable.

$ chmod +x acServer.sh

Finally, edit your Server Manager config.yml file and change the value for executable_path to be acServer.sh.