mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #62736
[Bug 1938347] [NEW] The $cfg->log_file option only writes the last output
Public bug reported:
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 because we open the file with:
$LOGFILE_FH = fopen($logfilename, 'wb');
What would be more useful is if the log file remembered existing lines
of logging for better diagnosis, eg appending new lines to end of file.
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
** Affects: mahara
Importance: Wishlist
Status: New
** Description changed:
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.
+ The problem with it though is on every write to the file it deletes the existing data because we open the file with:
+ $LOGFILE_FH = fopen($logfilename, 'wb');
What would be more useful is if the log file remembered existing lines
- of logging for better diagnosis.
+ of logging for better diagnosis, eg appending new lines to end of file.
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
** Changed in: mahara
Importance: Undecided => Wishlist
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: mahara-contributors
https://bugs.launchpad.net/bugs/1938347
Title:
The $cfg->log_file option only writes the last output
Status in Mahara:
New
Bug description:
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 because we open the file with:
$LOGFILE_FH = fopen($logfilename, 'wb');
What would be more useful is if the log file remembered existing lines
of logging for better diagnosis, eg appending new lines to end of
file.
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
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1938347/+subscriptions
Follow ups