0

Hi, I want to creat a record of user journey thought the game I'm coding, that would record a script of the user inputs to a separate log file, I am thinking of creating a userrecord class and the user input will be stored into a text file using filewriter class from java.io.package. Not sure if I write into the file with evey input or store the input into a stack and write at the end of the game. The former avoids the possibity of something goes wrong in the middle of the game, the later insures that problems of file changing directory or other errors (read many problems arise this way) Tom happening. Is there a good practice on doing this?
Thanks!

2
Contributors
2
Replies
3
Views
4 Years
Discussion Span
Last Post by mumaga
0

A log file is incredibly useful when things go wrong, provided it has been written to disk. So for me, waiting until the end to write it is not a good idea because a crash may prevent it being written. I would write all the records ditrectly to the file (or Java/OS buffer to be precise), maybe flushing the output buffer every "n" records just in case.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.