FreeOrion

Forums for the FreeOrion project
It is currently Wed Dec 13, 2017 1:43 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Jun 12, 2017 12:03 pm 
Offline
Dyson Forest
User avatar

Joined: Mon Apr 10, 2017 4:25 pm
Posts: 246
The fact that the logs get reset each time you load a game is a nuisance to track down AI's problems that only appear on mid/late game (if the problems only get apparent way after the AI made the decision that caused it, you will have lost the logs in which the AI's decision was logged).

A workaround for this is to backup all the logs each time you exit a game, but this is annoying and awkward, and I very often fail to do so since I mostly play late on night when I'm already tired and not very professional.

Would it be possible to allow test builds of FO to keep the information of the whole game no matter when you (re)load?

I realise it is not as simple as opening the log files with append mode instead of write. If you save a game on turn N, then play until turn N+10, then reload the turn N save, you don't want to just open the logs of turn N+10 to append, you would need the logs that you had on turn N. Moreover, you don't want to have hundreds of previous logs with endless repeated information, so you don't want to keep the logs of previous games, nor to keep the logs of every turn on separated files (because at turn N you will have the info of turn 1 repeated in N files. This could easily snowball and clutter your disk.

So I can reformulate the question as this:

Would it be possible to save the logs along the saved game when using the save game option in the FO test builds?

Thus, auto saves wouldn't keep logs, but user saved games would copy the logs along with the game (for example, using path save/<save name>_<log_name>, like "save/my_last_saved_game_AI_5.log") and on loading it would copy (overwrite) the corresponding logs over the their standard location and open them on append mode.


Top
 Profile  
 
PostPosted: Mon Jun 12, 2017 2:14 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12041
Location: Munich
The game doesn't save the log text in memory; it just writes it immediately to file after each log message.

It should be possible to give log files distinct names with a timestamp, and have an option to not delete any of them, though.


Top
 Profile  
 
PostPosted: Mon Jun 12, 2017 3:30 pm 
Offline
Dyson Forest
User avatar

Joined: Mon Apr 10, 2017 4:25 pm
Posts: 246
Geoff the Medio wrote:
It should be possible to give log files distinct names with a timestamp, and have an option to not delete any of them, though.
Yeah. That would work.

It could also consist of just:
- When saving a game, make a copy of the current log files into the save folder appending the save name in front of the log files (prefix).
- When loading a saved game, copy the saved log files from the save folder into ".." (removing the save game prefix), and then open them in append mode (instead of write) to continue the logging.

Assuming that would be the correct way (seems too simple to be true for a client/server application), I acknowledge it is not quite straightforward (or maybe it is and it's just my lack of C++ skills, I haven't touched it in like 15 years). I understand the saving part would be done in SaveGame(), and the loading part in LoadGame(), both in server/SaveLoad.cpp. But I bet the logging processes are started before LoadGame() so something may have to be done out of those functions. Right now I'm trying to locate the declaration of DebugLogger(), just by web-browsing the repository, but I know I should get time to learn git, pull the repository into my machine and use an IDE for this.
I ran out of time for now.


Top
 Profile  
 
PostPosted: Mon Jun 12, 2017 4:35 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12041
Location: Munich
https://github.com/freeorion/freeorion/ ... ger.h#L297


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group