Console.log rotate
by Lee Latham · in Torque Game Engine · 03/04/2008 (1:30 am) · 4 replies
How would one go about saving console.log's in a rotation? For example, append a number to the name, so that you never lose log data?
I guess I'm wondering if anyone's run across a resource or forum post that describes how to do it. My C++ is not adequate to the task.
But I keep losing logs I need because I am too quick to restart my server :-}
I guess I'm wondering if anyone's run across a resource or forum post that describes how to do it. My C++ is not adequate to the task.
But I keep losing logs I need because I am too quick to restart my server :-}
#2
03/05/2008 (8:19 am)
Handy!
#3
03/05/2008 (9:14 am)
I see that this isn't adequate for the logging modes where the file is opened and closed each write. (That is, there are other console creation sections of code for other modes. This just handles perhaps the most common access methods.)
#4
03/05/2008 (2:40 pm)
Thanks Matthew!
Torque 3D Owner Matthew Jessick
In engine/code/console.cc, find the method: void setLogMode(S32 newMode)
and replace the line that opens the console.log file:
with:
This will create a file name like: console_20080304_130045.log (encoding the date and time of opening).
An improvement would be to parse the defLogFileName for the "console" and the ".log" parts rather than just hardcoding it as above.