Log texvc errors in 'texvc' log channel

This patch adds wfDebugLog() calls for conditions related to texvc invocations.
The logs are grouped under a 'texvc' group, added for this purpose. The reason
for logging into a separate channel is that the Math channel is too verbose for
production use on the Wikimedia cluster.

Change-Id: I05a17a0230f49f5d698b91617d06b3e3f838b67d
This commit is contained in:
Ori Livneh 2013-10-14 15:28:43 -07:00
parent b6ed9af2bf
commit 679ce7fe2f
1 changed files with 6 additions and 1 deletions

View File

@ -129,6 +129,7 @@ class MathTexvc extends MathRenderer {
global $wgTexvc, $wgTexvcBackgroundColor, $wgUseSquid, $wgMathCheckFiles;
$tmpDir = wfTempDir();
if ( !is_executable( $wgTexvc ) ) {
wfDebugLog( 'texvc', "$wgTexvc does not exist or is not executable." );
return $this->getError( 'math_notexvc' );
}
@ -146,13 +147,17 @@ class MathTexvc extends MathRenderer {
$cmd = 'sh -c ' . wfEscapeShellArg( $cmd );
}
wfDebugLog( 'Math', "TeX: $cmd\n" );
$contents = wfShellExec( $cmd );
wfDebugLog( 'texvc', "Executing '$cmd'." );
$retval = null;
$contents = wfShellExec( $cmd, $retval );
wfDebugLog( 'Math', "TeX output:\n $contents\n---\n" );
if ( strlen( $contents ) == 0 ) {
if ( !file_exists( $tmpDir ) || !is_writable( $tmpDir ) ) {
wfDebugLog( 'texvc', "TeX output directory $tmpDir is missing or not writable" );
return $this->getError( 'math_bad_tmpdir' );
} else {
wfDebugLog( 'texvc', "TeX command '$cmd' returned no output and status code $retval." );
return $this->getError( 'math_unknown_error' );
}
}