A game i play, Terraria, tends to work fine for a while then freeze for anywhere from a few seconds to until i force my computer to restart. I'd like to know why it does this and how i can fix it. I figure a good start is running the game from the terminal and recording that terminal's output.
Just saving the output to a file manually isn't an option because when the problems start my computer is frozen. What i need is some way to make it write the output to a file as the program runs, and save that regularly so i still have most of it even if my computer crashes.
Is there something i can append to any command to do this, or maybe some other command that enables logging? I'm using MATE 22.2, if that helps.
Adding >>log.txt 2>>error.txt to the end of the command works. File names are arbitrary, but the error log is specified by 2>> instead of just >>. Thanks everyone.
7 Comments
cypherpunks@lemmy.ml · 10 pts · 262d
programname >>my_output.txt 2>>my_errors.txtThis will run
programname(replace that with name of the program you actually want to run) and append its standard output and standard error to the filesmy_output.txtandmy_errors.txt(those filenames are arbitrary, you can call them whatever you want).If you use
>instead of>>it will overwrite the specified files each time you run it again, instead of appending to them if they already exist as>>does. In either case the files will be created if they do not exist.You can read more about redirecting I/O in UNIX shells here.
IndigoGollum@lemmy.world · 2 pts · 262d
That works, thanks. I thought at first it didn't but apparently there's not normally as much stuff printed to the terminal as i expected.
kutsyk_alexander@lemmy.world · 5 pts · 262d
Explanation
dxc@sh.itjust.works · 3 pts · 262d
Thanks for the link, what a good explanation. Although reading through stderr gave me the impression its written by an LLM because of the use of 2>>
gfg0622 @Anshu-ka-lappi:-$ cat error_log.txt ls: cannot access 'non existent file': No such file or directory ls: cannot access 'non 'non_exist existent file 2': No such file or directorydxc@sh.itjust.works · 1 pts · 262d
You're looking for a log file, most probably hidden in the home folder. Quick online search only led me to server and modloader log files. I did find a relevant thread on reddit though, maybe its a step in the right direction.
IndigoGollum@lemmy.world · 1 pts · 262d
It had not occurred to me to see if the game was already logging stuff.
dxc@sh.itjust.works · 1 pts · 262d
On the other hand, it did not occur to me that it is not logging lmao