Page MenuHomePhabricator

MediaWiki logger silently loses invalid log messages
Open, Needs TriagePublic

Description

For more context, see T301764: Fix error logging in TranslateRenderJob.

To summarize, the following code silently fails to log an error message:

if ( !$editStatus->isOK() ) {
    $this->logError(
        'Error while editing content in page.',
        [
            'content' => $content,
            'errors' => $editStatus->getErrors()
        ]
    );
}

I assume the error is that $content is an object and not a primitive.

PS: $this->logError is just wrapper:

	protected function logError( $msg, $context = [] ) {
		LoggerFactory::getInstance( self::CHANNEL_NAME )->error( $this->getLogPrefix() . $msg, $context );
	}

Expected behavior: Failure to log is explicit, either via an exception or a log message about failure to log.

Event Timeline

Nikerabbit renamed this task from MediaWiki logger silently loses invalid events to MediaWiki logger silently loses invalid log messages.Feb 23 2022, 2:46 PM
Nikerabbit updated the task description. (Show Details)

If it's happening in an ELK stack, probably a case of T238196: Logging fields conflicts (tracking).