If I am writing to a log file, is there any kind of limit I need to account for? I'm wondering if you could crash by continuously writing to the same file?
I am planning to reset for each session. But in a few hours of gameplay I could see it growing rather large. Any thoughts?
I am planning to reset for each session. But in a few hours of gameplay I could see it growing rather large. Any thoughts?
Comments
Pick a size limit. When you hit that limit, move log to log.1 or something.
Always use routines that close the file on failure.
Make sure it commits to disk on a crash or your logs are useless.
Consider if you care about keeping multiple runs of logs.
Always have logging levels. You don't need high detail all the time.
Most modern logging systems allow you to specify some kind of rollover, e.g. one log per day, or max 3mb per log, or whatever.
You could also technically make a user run out of space, especially if big logs never get purged.