Jump to content

Any way to flush the log file while the game is still running?


SpazmoJones

Recommended Posts

Does anyone know how to force the game to flush its log file? I'm using the LogInternal function which writes to the "..\My Games\XCOM - Enemy Within\XComGame\Logs\Launch.log" file, like this:

 

E7 1F <%t "Log message!"> 2A 16

 

The problem is this file only gets updated once the game has been closed. I'd like to be able to view the "current" log file while the game is running without having to quit all the way out to see if something worked or not. Is this possible?

Link to comment
Share on other sites

It might not really be easy, it could be the underlying system doing the buffering and you'd need native code to disable the crt buffering if that's the case. On Mac/Linux you could try putting a newline in the string, but that probably won't work for windows. You could also write a bunch of junk to the log to fill the buffer and cause a flush, but that might be hard to read.
Link to comment
Share on other sites

It might not really be easy, it could be the underlying system doing the buffering and you'd need native code to disable the crt buffering if that's the case. On Mac/Linux you could try putting a newline in the string, but that probably won't work for windows. You could also write a bunch of junk to the log to fill the buffer and cause a flush, but that might be hard to read.

 

Thanks for the tip. I found that I had to write at least 4K at a time to get the data on the disk. I'm using this log file in my new "music" replacement mod http://www.nexusmods.com/xcom/mods/584/

 

I hope this 4K thing works on other PCs too, not just mine... :)

Link to comment
Share on other sites

  • 6 months later...

I am sorry to dig up old thread, but you can see LogInternal function's output in log's window.

 

Just put -log switch into launch options of the game (Steam / Library / right click on XCOM: Enemy Uknown and select Properties / General Tab, Set Launch Options button).

Edited by Drakous79
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...