Commit 5c5c16bb authored by martinlanghoff's avatar martinlanghoff
Browse files

Apache log integration -- updated with more options to control what is logged...

Apache log integration -- updated with more options to control what is logged as username. Implemented by Patrick Li.
parent 2fa17f9c
......@@ -248,6 +248,14 @@ $CFG->admin = 'admin';
// entry in apache error log indicating the position of the error and the statement
// called. This option will action disregarding error_reporting setting.
// $CFG->dblogerror = true;
// The following setting will turn on username logging into Apache log. For full details regarding setting
// up of this function please refer to the install section of the document.
// $CFG->apacheloguser = 0; // Turn this feature off. Default value.
// $CFG->apacheloguser = 1; // Log user id.
// $CFG->apacheloguser = 2; // Log full name in cleaned format. ie, Darth Vader will be displayed as darth_vader.
// $CFG->apacheloguser = 3; // Log username. CAUTION: Use of this value will expose usernames in the Apache log,
// If you are going to publish your log in any cases, this will be a BIG security problem.
// ALL DONE! To continue installation, visit your main page with a browser
......@@ -411,8 +411,20 @@ global $THEME;
/// Apache log intergration. In apache conf file one can use ${MOODULEUSER}n in
/// LogFormat to get the current logged in username in moodle.
if ($USER && function_exists('apache_note')) {
apache_note('MOODLEUSER', $USER->username);
if ($USER && function_exists('apache_note') && !empty($CFG->apacheloguser)) {
switch ($CFG->apacheloguser) {
case 3:
$logname = clean_filename($USER->username);
case 2:
$logname = clean_filename($USER->firstname." ".$USER->lastname);
case 1:
$logname = $USER->id;
apache_note('MOODLEUSER', $logname);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment