Vice City: Multiplayer

VC:MP Discussion => Support => Bugs and Crashes => Topic started by: EK.IceFlake on Jan 16, 2017, 04:50 PM

Title: [BUG] server_log.txt has color codes and is not the complete log
Post by: EK.IceFlake on Jan 16, 2017, 04:50 PM
Description
This image will explain
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fq6XL9gP.png&hash=fab35a10f5c4ce526569cd8e67dab61f2d057f86)
(as you can see, at the end, after the quotation mark, there is no text, however, the console should have it)

Reproducible
Always

What you were doing when the bug happened
Trying to show a console in the web browser by projecting server_log.txt

What you think caused the bug
Color codes: A print function that saves directly to log without removing some stuff
Incomplete log: No idea
Title: Re: [BUG] server_log.txt has color codes and is not the complete log
Post by: jWeb on Jan 16, 2017, 05:31 PM
Because it uses buffered I/O. Meaning the log messages are only flushed to the file if the internal buffer is full. Otherwise it's written to the buffer and kept there until there's no more room. To force the log file to be synchronized you either have to flush the buffer after each message (could generate some intensive IO if too many servers do this simultaneously) or shut down the server (which if the one's that wrote the logging were smart enough, would force the buffer to be flushed before closing the file handle). The first one can't be achieved without the source and the second one is not desired. So the log file is not your option.

Your other choice is to redirect the console output to a file and use that to see what the server is logging. I believe `screen` can do this automatically IIRC.
Title: Re: [BUG] server_log.txt has color codes and is not the complete log
Post by: KAKAN on Jan 16, 2017, 06:03 PM
Quote from: jWeb on Jan 16, 2017, 05:31 PMshut down the server (which if the one's that wrote the logging were smart enough, would force the buffer to be flushed before closing the file handle)
The last time I checked, this technique was not working. That log would still be...
Title: Re: [BUG] server_log.txt has color codes and is not the complete log
Post by: Thijn on Jan 16, 2017, 06:35 PM
https://www.gnu.org/software/screen/manual/screen.html#Invoking-Screen
Check the -L command line option