Page 1 of 1

Log Files

Posted: 31 Dec 2016 11:09
by Carolusclen
Hey everyone

I am trying to find out how to dump the console of a Dedicated server to a log file.

The closest thing i could find all day was by using a script like so

File name: On_dedicated.scr
Content;
echo "Starting server"
script openttd.log

The issue is that the "script openttd.log" is not verbose

my questions is, is there ANY WAY to have the console window write to a log file in verbose mode
I do know the Linux has a command line that writes it to file because of the lack of a window. Wish there was a PC version to that.

Thanks :)

Re: Log Files

Posted: 31 Dec 2016 11:11
by planetmaker
<smartass>I run linux on my PC. So there definitely is.</smartass>

There's some way to convert OpenTTD to a console application on windows, too - but I don't recall how. But it's for sure somewhere here in this forum or in our wiki. Try searching for something like "OpenTTD console windows" or such on the search bars of these pages.

Re: Log Files

Posted: 31 Dec 2016 11:25
by Carolusclen
planetmaker wrote:<smartass>I run linux on my PC. So there definitely is.</smartass>

There's some way to convert OpenTTD to a console application on windows, too - but I don't recall how. But it's for sure somewhere here in this forum or in our wiki. Try searching for something like "OpenTTD console windows" or such on the search bars of these pages.

haha fair enough. Ill have a look at consoles then. I do know running openttd with the -D commandline runs is as a console dedicated server. I still cant find how to dump that console to a log file D:

Re: Log Files

Posted: 31 Dec 2016 16:44
by Carolusclen
Ok, so I found a way around it for now. For anyone else looking into this, do the following. This goes based on a basic knowledge of powershell scripts

Open a text file and type in the following

Code: Select all

Start-Process -FilePath ".\openttd.exe" -Argumentlist "-D -d 4" -RedirectStandardError "logfile.log"
then save it as Server.ps1

Basically what this does is
1) This starts a new windows process of openttd.

Code: Select all

Start-Process -FilePath ".\openttd.exe"
2) This assigns the command line options to the process. In this case its -D for dedicated server and -d 4 for level 4 debugging

Code: Select all

-Argumentlist "-D -d 4"
3) This redirects all the info from the console window to the text file of your choosing.

Code: Select all

-RedirectStandardError "logfile.log"
I have uploaded a script for peoples convenience.
Please note for the new people in powershell scripting, your computer may need to have the powershell "run custom scripts" enabled. here is a link to learn how https://technet.microsoft.com/en-us/lib ... 76961.aspx

https://www.dropbox.com/s/rfuoincj3uk1h ... r.ps1?dl=1

If you want to see the content of the file, just open in notepad

Re: Log Files

Posted: 13 Jan 2017 08:34
by HGus
If you try:

Code: Select all

.\openttd.exe -D -d 4 >logfile.log
... in a standard cmd script?