- Joined
- Feb 14, 2015
- Messages
- 5,643
- Solutions
- 559
- Reaction score
- 3,948
For users that don't have Python 3.6 installed on their system, I provided a rar file with a Python executable that will be able to run without Python being installed.
It is by no means required to use the executable, if you have Python installed all you need to do is use this script (this is also the executable's source)
Simply put the script or executable in your server's directory where your TFS executable is and run it.
This will run TFS itself, so there is no need to start TFS on your own after running the script/executable.
The output of the logs will be inside of a folder called "logs" in your server's directory, with the name "tfs log month-day-year"
If you desire the date output to be day-month-year, change "%m-%e-%G" to "%e-%m-%G" in the script.
It is by no means required to use the executable, if you have Python installed all you need to do is use this script (this is also the executable's source)
Python:
import subprocess
import time
import os
DIR = os.getcwd()
EXE = "theforgottenserver.exe"
TFS = subprocess.Popen(DIR + "/" + EXE, cwd=DIR, stdout=subprocess.PIPE)
timestamp = time.strftime("%m-%e-%G", time.localtime())
filename = DIR + "/logs/tfs log " + timestamp + ".txt"
if not os.path.exists(filename):
os.mkdir(os.path.dirname(filename))
with open(filename, "a") as file:
for line in TFS.stdout:
txt = line.decode().strip()
file.write("{} | {}\n".format(time.strftime("%H:%M:%S", time.localtime()), txt))
print(txt)
file.flush()
file.write(time.strftime("%H:%M:%S", time.localtime()) + " | Server Closed\n\n\n")
This will run TFS itself, so there is no need to start TFS on your own after running the script/executable.
The output of the logs will be inside of a folder called "logs" in your server's directory, with the name "tfs log month-day-year"
If you desire the date output to be day-month-year, change "%m-%e-%G" to "%e-%m-%G" in the script.
Attachments
-
Console Logger.rar3.8 MB · Views: 24 · VirusTotal