Replace add_to_log() statement. Do this only for the case when anonymous mode is off,
since this is what was happening before.

@return array of parameters to be passed to legacy add_to_log() function.
557504
protected function get_legacy_logdata() {
        if ($this->anonymous) {
            return null;
        } else {
            return array($this->courseid, 'feedback', 'submit', 'view.php?id=' . $this->other['cmid'],
                    $this->other['instanceid'], $this->other['cmid'], $this->relateduserid);
        }
    }
579282
protected function get_legacy_logdata() {
        // The legacy log table expects a relative path to /mod/forum/.
        $logurl = substr($this->get_url()->out_as_local_url(), strlen('/mod/forum/'));

        return array($this->courseid, 'forum', 'delete post', $logurl, $this->objectid, $this->contextinstanceid);
    }
633311
@Nonnull
    public String[] getLoggerList() {
        try {
            Enumeration<Logger> currentLoggers = LogManager.getLoggerRepository().getCurrentLoggers();
            List<String> loggerNames = new ArrayList<String>();
            while (currentLoggers.hasMoreElements()) {
                loggerNames.add(currentLoggers.nextElement().getName());
            }
            return loggerNames.toArray(new String[0]);
        } catch (RuntimeException e) {
            logger.warn("Exception getting logger names", e);
            throw e;
        }
    }
1197863
public function addLogger() 
    {

        $args = func_get_args();

        foreach ($args as $class) {
            if (!in_array($class, $this->loggers) && 
                ($class instanceof IDS_Log_Interface)) {
                $this->loggers[] = $class;
            }
        }
    }
637176
public function log()
    {
        if (!$this->output) { return $this; }

        foreach (func_get_args() as $line) {

            if (is_array($line)) {
                call_user_func_array([ $this->output, 'write' ], $line);
                continue;
            }

            $this->output->write($line);
        };

        return $this;
    }
790698
protected function get_legacy_logdata() {
        if ($this->other['associatetype'] === 'course') {
            return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
                    $this->other['blogid'], $this->other['subject'], 0, $this->relateduserid);
        }

        return array (SITEID, 'blog', 'add association', 'index.php?userid=' . $this->relateduserid. '&entryid=' .
                $this->other['blogid'], $this->other['subject'], $this->other['associateid'], $this->relateduserid);
    }
409974
function addLoggers($loggers)
	{
		foreach(func_get_args() as $logger)
		{
			if(is_array($logger))
			{
				foreach($logger as $sublogger)
				{
					$this->addLoggers($sublogger);
				}
			}
			else if(is_object($logger))
			{
				$this->_loggers[] = $logger;
			}
		}

		return $this;
	}
1296590
def new_log(self):
        
        log_id = self._num_logs
        self._logs[log_id] = []
        self._num_logs += 1
        return log_id
636163
protected function _loggerSanity()
    {
        if (!isset($this->_options['logging']) || !$this->_options['logging']) {
            return;
        }

        if (isset($this->_options['logger']) && $this->_options['logger'] instanceof Zend_Log) {
            return;
        }

        // Create a default logger to the standard output stream
        // require_once 'Zend/Log.php';
        // require_once 'Zend/Log/Writer/Stream.php';
        // require_once 'Zend/Log/Filter/Priority.php';
        $logger = new Zend_Log(new Zend_Log_Writer_Stream('php://output'));
        $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::WARN, '<='));
        $this->_options['logger'] = $logger;
    }
1036559
public function addTraceFunctionArgsToOutput($addTraceFunctionArgsToOutput = null)
    {
        if (func_num_args() == 0) {
            return $this->addTraceFunctionArgsToOutput;
        }

        if (! is_integer($addTraceFunctionArgsToOutput)) {
            $this->addTraceFunctionArgsToOutput = (bool) $addTraceFunctionArgsToOutput;
        } else {
            $this->addTraceFunctionArgsToOutput = $addTraceFunctionArgsToOutput;
        }
    }
884043
protected function get_legacy_logdata() {
        return array($this->courseid, 'course', 'loginas', '../user/view.php?id=' . $this->courseid . '&amp;user=' . $this->userid,
            $this->other['originalusername'] . ' -> ' . $this->other['loggedinasusername']);
    }
320363
protected function createLogHandlers() {
        $logHandlers = $this->configuredLogHandlers;
                      
        foreach ($logHandlers as $handlerNamespace => $handlerDetails) {
            if (
                is_array($handlerDetails)
                && array_key_exists('handler_parameters', $handlerDetails)
            ) {
                $handlerParameters = $handlerDetails['handler_parameters'];
                $handlerObj = new $handlerNamespace(...$handlerParameters);
                $this->concreteLogger->pushHandler($handlerObj);
            }
        }
    }
1318564
protected function logVerbose()
  {
    $args   = func_get_args();
    $format = array_shift($args);

    foreach ($args as &$arg)
    {
      if (!is_scalar($arg)) $arg = var_export($arg, true);
    }

    if (sizeof($args)==0)
    {
      $this->log($format, \Project::MSG_VERBOSE);
    }
    else
    {
      $this->log(vsprintf($format, $args), \Project::MSG_VERBOSE);
    }
  }
1150564
public function addLog ( $keys, $received, $sent, $base_string, $notes, $user_id = null )
	{
		$args = array();
		$ps   = array();
		foreach ($keys as $key => $value)
		{
			$args[] = $value;
			$ps[]   = "olg_$key = '%s'";
		}

		if (!empty($_SERVER['REMOTE_ADDR']))
		{
			$remote_ip = $_SERVER['REMOTE_ADDR'];
		}	
		else if (!empty($_SERVER['REMOTE_IP']))
		{
			$remote_ip = $_SERVER['REMOTE_IP'];
		}
		else
		{
			$remote_ip = '0.0.0.0';
		}

		// Build the SQL
		$olg_received = $this->makeUTF8($received);
		$olg_sent = $this->makeUTF8($sent);
		$olg_base_string = $base_string;
		$olg_notes = $this->makeUTF8($notes);
		$olg_usa_id_ref = $user_id;
		$olg_remote_ip = $remote_ip;

		 

		$sql = "BEGIN SP_ADD_LOG(:P_RECEIVED, :P_SENT, :P_BASE_STRING, :P_NOTES, :P_USA_ID_REF, :P_REMOTE_IP, :P_RESULT); END;";

			// parse sql
		$stmt = oci_parse($this->conn, $sql) or die ('Can not parse query');

		// Bind In and Out Variables
		oci_bind_by_name($stmt, ':P_RECEIVED', $olg_received, 255);
		oci_bind_by_name($stmt, ':P_SENT', $olg_sent, 255);
		oci_bind_by_name($stmt, ':P_BASE_STRING', $olg_base_string, 255);
		oci_bind_by_name($stmt, ':P_NOTES', $olg_notes, 255);
		oci_bind_by_name($stmt, ':P_USA_ID_REF', $olg_usa_id_ref, 255);
		oci_bind_by_name($stmt, ':P_REMOTE_IP', $olg_remote_ip, 255);
		oci_bind_by_name($stmt, ':P_RESULT', $result, 20);


		//Execute the statement
		oci_execute($stmt);
	}
1192919
public function addLog ( $keys, $received, $sent, $base_string, $notes, $user_id = null )
    {
        $args = array();
        $ps   = array();
        foreach ($keys as $key => $value)
        {
            $args[] = $value;
            $ps[]   = "olg_$key = '%s'";
        }

        if (!empty($_SERVER['REMOTE_ADDR']))
        {
            $remote_ip = $_SERVER['REMOTE_ADDR'];
        }
        else if (!empty($_SERVER['REMOTE_IP']))
        {
            $remote_ip = $_SERVER['REMOTE_IP'];
        }
        else
        {
            $remote_ip = '0.0.0.0';
        }

        // Build the SQL
        $ps['olg_received']    = "'%s'";                        $args[] = $this->makeUTF8($received);
        $ps['olg_sent']        = "'%s'";                        $args[] = $this->makeUTF8($sent);
        $ps['olg_base_string'] = "'%s'";                        $args[] = $base_string;
        $ps['olg_notes']       = "'%s'";                        $args[] = $this->makeUTF8($notes);
        $ps['olg_usa_id_ref'] = "NULLIF('%d', '0')";            $args[] = $user_id;
        $ps['olg_remote_ip']  = "NULLIF('%s','0.0.0.0')";        $args[] = $remote_ip;

        $this->query('
            INSERT INTO oauth_log ('.implode(',', array_keys($ps)) . ')
            VALUES(' . implode(',', $ps) . ')',
            $args
        );
    }
732652
public function get_legacy_logdata() {
        return array($this->courseid, 'data', 'update', 'view.php?d=' . $this->other['dataid'] . '&amp;rid=' . $this->objectid,
            $this->other['dataid'], $this->contextinstanceid);
    }
1286331
public static function get_conversation_messages_parameters() {
        return new external_function_parameters(
            array(
                'currentuserid' => new external_value(PARAM_INT, 'The current user\'s id'),
                'convid' => new external_value(PARAM_INT, 'The conversation id'),
                'limitfrom' => new external_value(PARAM_INT, 'Limit from', VALUE_DEFAULT, 0),
                'limitnum' => new external_value(PARAM_INT, 'Limit number', VALUE_DEFAULT, 0),
                'newest' => new external_value(PARAM_BOOL, 'Newest first?', VALUE_DEFAULT, false),
                'timefrom' => new external_value(PARAM_INT,
                    'The timestamp from which the messages were created', VALUE_DEFAULT, 0),
            )
        );
    }