Transport Tycoon Forums
https://www.tt-forums.net/

Log Files
https://www.tt-forums.net/viewtopic.php?f=65&t=75648
Page 1 of 1

Author:  Carolusclen [ Sat Dec 31, 2016 11:09 am ]
Post subject:  Log Files

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 :)

Author:  planetmaker [ Sat Dec 31, 2016 11:11 am ]
Post subject:  Re: Log Files

<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.

Author:  Carolusclen [ Sat Dec 31, 2016 11:25 am ]
Post subject:  Re: Log Files

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:

Author:  Carolusclen [ Sat Dec 31, 2016 4:44 pm ]
Post subject:  Re: Log Files

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:
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:
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:
-Argumentlist "-D -d 4"

3) This redirects all the info from the console window to the text file of your choosing.
Code:
-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/library/ee176961.aspx

https://www.dropbox.com/s/rfuoincj3uk1hxx/OpenTTD%20Server.ps1?dl=1

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

Author:  HGus [ Fri Jan 13, 2017 8:34 am ]
Post subject:  Re: Log Files

If you try:

Code:
.\openttd.exe -D -d 4 >logfile.log


... in a standard cmd script?

Page 1 of 1 All times are UTC
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.