Skip to content

Conversation

@rfortier
Copy link
Contributor

@rfortier rfortier commented Jan 4, 2026

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).

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 on every log line at [info] or greater. This is to make sure that crash logs are up-to-date (or reasonably close).
Copy link
Collaborator

@miredirex miredirex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

spdlog::critical(__FUNCTION__ ": coredump created -> flush logs.");
}
}
spdlog::default_logger()->flush();

I think we already flush logs on any crash

@rfortier
Copy link
Contributor Author

rfortier commented Jan 4, 2026

Flushes server console log every 2 seconds.

Could it cause lag? Or does it happen in background?

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.

spdlog::critical(__FUNCTION__ ": coredump created -> flush logs.");
}
}
spdlog::default_logger()->flush();

I think we already flush logs on any crash

Well, yeah. I'm pretty sure I put that line there when I made crashloggers work.
It doesn't work, though. Probably because it is flushing the wrong logger, I didn't know as much at the time. Or, because we're crashing and the logger is borked. Keeping the log reasonably up-to-date should work around the issue regardless.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants