mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-26 10:44:50 +03:00
Fix exception logging
This commit is contained in:
@@ -124,7 +124,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error starting ffmpeg", ex);
|
||||
Logger.LogError(ex, "Error starting ffmpeg");
|
||||
|
||||
OnTranscodeFailedToStart(encodingJob.OutputFilePath, encodingJob);
|
||||
|
||||
@@ -179,9 +179,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
|
||||
isSuccesful = exitCode == 0;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("FFMpeg exited with an error.");
|
||||
Logger.LogError(ex, "FFMpeg exited with an error.");
|
||||
}
|
||||
|
||||
if (isSuccesful && !job.IsCancelled)
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
{
|
||||
if (logOutput)
|
||||
{
|
||||
_logger.LogError("Error validating encoder", ex);
|
||||
_logger.LogError(ex, "Error validating encoder");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,9 +78,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
{
|
||||
output = GetProcessOutput(encoderAppPath, "-decoders");
|
||||
}
|
||||
catch (Exception )
|
||||
catch (Exception ex)
|
||||
{
|
||||
//_logger.LogError("Error detecting available decoders", ex);
|
||||
_logger.LogError(ex, "Error detecting available decoders");
|
||||
}
|
||||
|
||||
var found = new List<string>();
|
||||
@@ -187,7 +187,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
RedirectStandardOutput = true
|
||||
});
|
||||
|
||||
_logger.LogInformation("Running {0} {1}", path, arguments);
|
||||
_logger.LogInformation("Running {path} {arguments}", path, arguments);
|
||||
|
||||
using (process)
|
||||
{
|
||||
@@ -199,16 +199,16 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch
|
||||
{
|
||||
_logger.LogInformation("Killing process {0} {1}", path, arguments);
|
||||
_logger.LogInformation("Killing process {path} {arguments}", path, arguments);
|
||||
|
||||
// Hate having to do this
|
||||
try
|
||||
{
|
||||
process.Kill();
|
||||
}
|
||||
catch (Exception ex1)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error killing process", ex1);
|
||||
_logger.LogError(ex, "Error killing process");
|
||||
}
|
||||
|
||||
throw;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error disposing log stream", ex);
|
||||
_logger.LogError(ex, "Error disposing log stream");
|
||||
}
|
||||
|
||||
LogFileStream = null;
|
||||
@@ -98,7 +98,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error closing media source", ex);
|
||||
_logger.LogError(ex, "Error closing media source");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,12 +72,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
catch (HttpException ex)
|
||||
{
|
||||
// Don't let the server crash because of this
|
||||
_logger.LogError("Error downloading ffmpeg font files", ex);
|
||||
_logger.LogError(ex, "Error downloading ffmpeg font files");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Don't let the server crash because of this
|
||||
_logger.LogError("Error writing ffmpeg font files", ex);
|
||||
_logger.LogError(ex, "Error writing ffmpeg font files");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
catch (IOException ex)
|
||||
{
|
||||
// Log this, but don't let it fail the operation
|
||||
_logger.LogError("Error copying file", ex);
|
||||
_logger.LogError(ex, "Error copying file");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
catch (Exception ex)
|
||||
{
|
||||
// The core can function without the font file, so handle this
|
||||
_logger.LogError("Failed to download ffmpeg font file from {0}", ex, url);
|
||||
_logger.LogError(ex, "Failed to download ffmpeg font file from {url}", url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,12 +145,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
catch (IOException ex)
|
||||
{
|
||||
// Log this, but don't let it fail the operation
|
||||
_logger.LogError("Error deleting temp file {0}", ex, tempFile);
|
||||
_logger.LogError(ex, "Error deleting temp file {path}", tempFile);
|
||||
}
|
||||
}
|
||||
private void Extract7zArchive(string archivePath, string targetPath)
|
||||
{
|
||||
_logger.LogInformation("Extracting {0} to {1}", archivePath, targetPath);
|
||||
_logger.LogInformation("Extracting {ArchivePath} to {TargetPath}", archivePath, targetPath);
|
||||
|
||||
_zipClient.ExtractAllFrom7z(archivePath, targetPath, true);
|
||||
}
|
||||
|
||||
@@ -102,8 +102,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
_originalFFMpegPath = ffMpegPath;
|
||||
|
||||
_hasExternalEncoder = hasExternalEncoder;
|
||||
|
||||
SetEnvironmentVariable();
|
||||
}
|
||||
|
||||
private readonly object _logLock = new object();
|
||||
@@ -117,7 +115,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||
_logger.LogError(ex, "Error setting FFREPORT environment variable");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,31 +130,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||
_logger.LogError(ex, "Error setting FFREPORT environment variable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetEnvironmentVariable()
|
||||
{
|
||||
try
|
||||
{
|
||||
//_environmentInfo.SetProcessEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||
}
|
||||
try
|
||||
{
|
||||
//_environmentInfo.SetUserEnvironmentVariable("FFREPORT", "file=program-YYYYMMDD-HHMMSS.txt:level=32");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error setting FFREPORT environment variable", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public string EncoderLocationType
|
||||
{
|
||||
get
|
||||
@@ -649,9 +627,9 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("I-frame image extraction failed, will attempt standard way. Input: {0}", inputArgument);
|
||||
_logger.LogError(ex, "I-frame image extraction failed, will attempt standard way. Input: {arguments}", inputArgument);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +977,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error in WaitForExit", ex);
|
||||
_logger.LogError(ex, "Error in WaitForExit");
|
||||
}
|
||||
|
||||
try
|
||||
@@ -1010,7 +988,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError("Error killing process", ex);
|
||||
_logger.LogError(ex, "Error killing process");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user