How to log console output on dedicated server?

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
gijs007
Engineer
Engineer
Posts: 3
Joined: 28 Jan 2017 13:54

How to log console output on dedicated server?

Post by gijs007 »

I'm running OpenTTD with the -D commandline argument (on Windows), to make OpenTTD run as a dedicated server.
I'd like to know if it's possible to log the console output to a log file? as I haven't found anyway to do this.

I've already tried to use a batch file to accomplish this:

Code: Select all

openttd.exe -D > console.log
The results in an empty console.log file, which is odd as this command normally outputs console applications text to the console.log file.
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: How to log console output on dedicated server?

Post by HGus »

Try this: viewtopic.php?f=65&t=75648

-D is not enough for logging, you still need the -d option too (debugging)
User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: How to log console output on dedicated server?

Post by adf88 »

HGus wrote:-D is not enough for logging, you still need the -d option too (debugging)
No. Default debug level (when we omit the -d option) is 0 and it does provide some most critical information. -d isn't mandatory, but it can be used to increase the level of detail.

gijs007: First try running OpenTTD in console and see if the information you are looking for is there:

Code: Select all

openttd -D
You can experiment with different -d options.

Then redirect to a file. The way you tried is almost OK. Console applications usually have two output streams, stdout and stderr. Content of both streams show up in console, but they can be redirected individually. And you redirected only the stdout while OpenTTD outputs debug info to stderr. To redirect both, try this construct:

Code: Select all

openttd -D >logfile.txt 2>&1
It's mandatory that "2>&1" is after ">logfile.txt".

If you would like to log contents of the in-game console then it's whole different story.
:] don't worry, be happy and checkout my patches
HGus
Engineer
Engineer
Posts: 121
Joined: 12 May 2013 22:28
Location: Argentina

Re: How to log console output on dedicated server?

Post by HGus »

ok, but the problem here is that openttd -D opens a new window for stdout. It remains silent for the source cmd box, so >logfile.txt fails. I am not sure if stderr is still directed to source or target window.
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: Google Feedfetcher and 29 guests