• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Windows Export console log to txt file

vichoko

Member
Joined
Oct 9, 2008
Messages
128
Reaction score
6
Location
Santiago, Chile
Hi there, i'm trying to come back with my 10.41 server.
Right now i'm executing the console and i have tons of errors in it and i want an easier way to read and fix them; because right there in the cmd its really difficult and last errors fills the windows making the first ones to dissapear.
I'm trying with this batch file for executing the server:
Code:
:again
START /WAIT .\theforgottenserver.exe>>log.txt
goto again

But the log.txt is always empty. Even if i close tfs.exe.

Any help will be thankful :)
 
Errors are handled internally unfortunately, they are printed directly to the console.
The only other way would be to manually script your scripts to write to a log file, or edit the sources to produce a log file.
 
Errors are handled internally unfortunately, they are printed directly to the console.
The only other way would be to manually script your scripts to write to a log file, or edit the sources to produce a log file.
Aha i understand.

Another problem i have.
I'm using this batch like a restarter too:
Code:
:again
START /WAIT .\theforgottenserver.exe
goto again

But i have the problem that when tfs.exe finishes, then the batch asks for confirmation before executing tfs.exe again (Like a restarter should do).
So the restartes isn't really doing its job.

I have Tfs 1.0. Any idea how to implement a restarter in Windows?
Thanks!
 
Aha i understand.

Another problem i have.
I'm using this batch like a restarter too:
Code:
:again
START /WAIT .\theforgottenserver.exe
goto again

But i have the problem that when tfs.exe finishes, then the batch asks for confirmation before executing tfs.exe again (Like a restarter should do).
So the restartes isn't really doing its job.

I have Tfs 1.0. Any idea how to implement a restarter in Windows?
Thanks!
What do you mean by confirmation? This one?
Windows-10-publisher-cannot-be-verified.png


If its this one you can just uncheck "Always ask before opening this file"

This batch works just fine for me with administrator rights tho.
 
You can do as @forgee mentioned, but if you want to be able to see the output in the command line you can use this:

http://stackoverflow.com/questions/11239924/windows-batch-tee-command/21841567#21841567

Here is an example:

Code:
:start
set datetime=%date:~-4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%
set outputfile=output%datetime%.txt
theforgottenserver.exe | batchTee %outputfile%
goto start

You just have to save the batch tee code as bachTee.bat in the same directory
 
You can redirect std-out and std-err to a file like this.
Code:
forgottenserver.exe 1>log.txt 2>&1
That approach didn't work :( but thanks anyway :) it gave me ideas to aboard another batch problems i had in mind.


You can do as @forgee mentioned, but if you want to be able to see the output in the command line you can use this:

http://stackoverflow.com/questions/11239924/windows-batch-tee-command/21841567#21841567

Here is an example:

Code:
:start
set datetime=%date:~-4%%date:~3,2%%date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2%
set outputfile=output%datetime%.txt
theforgottenserver.exe | batchTee %outputfile%
goto start

You just have to save the batch tee code as bachTee.bat in the same directory


Thanks man! This solution worked for me very well. Now i'm getting the logs correctly :)
 
Back
Top