Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Fri Jun 23, 2017 1:52 pm

All times are UTC




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Log Files
PostPosted: Sat Dec 31, 2016 11:09 am 
Offline
Engineer
Engineer

Joined: Sat Dec 31, 2016 10:59 am
Posts: 3
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 :)


Top
   
 Post subject: Re: Log Files
PostPosted: Sat Dec 31, 2016 11:11 am 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Wed Nov 07, 2007 10:44 pm
Posts: 9012
Location: Sol d
<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.

_________________
Image
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML


Top
   
 Post subject: Re: Log Files
PostPosted: Sat Dec 31, 2016 11:25 am 
Offline
Engineer
Engineer

Joined: Sat Dec 31, 2016 10:59 am
Posts: 3
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:


Top
   
 Post subject: Re: Log Files
PostPosted: Sat Dec 31, 2016 4:44 pm 
Offline
Engineer
Engineer

Joined: Sat Dec 31, 2016 10:59 am
Posts: 3
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


Top
   
 Post subject: Re: Log Files
PostPosted: Fri Jan 13, 2017 8:34 am 
Offline
Engineer
Engineer

Joined: Sun May 12, 2013 10:28 pm
Posts: 86
Location: Argentina
If you try:

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


... in a standard cmd script?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.