Comment 0 for bug 1938347

Revision history for this message
Robert Lyon (robertl-9) wrote :

There is a configuration option in Mahara where you can specify a file to save logging to. This is useful if you are wanting to debug something but do not have access to the apache/nginx error logs.

The problem with it though is on every write to the file it deletes the existing data.

What would be more useful is if the log file remembered existing lines of logging for better diagnosis.

We would need to do it in such a way that we didn't end up with one giant log file that keeps growing until the server is full.

My idea is this:

If you have $cfg->log_file = $cfg->dataroot . '/logs/custom.log';

On writing to the file check the number of lines existing in the custom.log file and once it gets to be more that a certain number, say 10000 lines, it copies that file to custom.log.old and starts a new custom.log file to write to

That way you only end up with max 2 files of max approx 20000 lines and it will be faster than trying to append new lines to base of custom.log while removing lines from start of custom.log