Update to PR #727 better better multithread logging#847
Conversation
miredirex
left a comment
There was a problem hiding this comment.
Flushes server console log every 2 seconds.
Could it cause lag? Or does it happen in background?
This is to make sure that crash logs are up-to-date (or reasonably close).
TiltedEvolution/Code/client/CrashHandler.cpp
Lines 100 to 104 in cecc9c8
I think we already flush logs on any crash
It won't cause lag. Doesn't for the console window, which flushes every line. For flush_every(), flushing is done on an async thread. Without this the console logfile is only flushed when it fills up a page, which is 8 or 16KB (so, could be very out-of-date). And, if you finish a session and kill the console window, it is never flushed.
Well, yeah. I'm pretty sure I put that line there when I made crashloggers work. But I will take a look and see which stream is the file logger; fixing that flush would be nice. The tweak as-is is still needed to flush the file, though, or things that are tailing/watching the log file won't be up to date. |
2d666cf to
4b7708f
Compare
|
It's been stable. Added one last tweak (date, helps us reject people sending wrong logs) |
4b7708f to
2cb5366
Compare
|
Suggestion: |
In addition to console window, make sure file logs contain the millisecond and thread ID. Flushes server console log every 2 seconds. Flushes client log every 1s. Will need to separately determine why the flush of the log when crashing doesn't work. But this is good-enough for tail'ing the client log file, and somewhat lower overhead then flushing on every line. Added date to timestamp, which will help us detect when someone sends us the wrong log for a bug.
2cb5366 to
c4d91df
Compare
|
Updated to flush_on( 1 second ) instead. Good enough for an active tail -f on the log file, and infinitesimal overhead. Will need to separately figure out why the flush in the crash path is not working. The correct sink is being flushed, but the log file is not being updated. |
Follow-on to PR #727
In addition to console window, make sure the file logs also contain the millisecond and thread ID.
Flushes server console log every 2 seconds.
Flushes client log on every log line at [info] or greater. This is to make sure that crash logs are up-to-date (or reasonably close).